Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anchor links generate corrupted Word documents #348

Open
catalan-adobe opened this issue May 16, 2024 · 0 comments
Open

Anchor links generate corrupted Word documents #348

catalan-adobe opened this issue May 16, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@catalan-adobe
Copy link
Collaborator

Description
Anchor links <a href="#anchor-link">Anchor Link</a> in document to import will generate corrupted Word document

To Reproduce
Steps to reproduce the behavior:

  1. Start the AEM Importer
  2. Force the "Transformation file URL" to a non existing URL to force usage of default import script
  3. Check "Save as docx"
  4. Import URL https://www.aami.com.au/
  5. Try to open the generated .docx => Word will display an error dialog: Word found unreadable content in index.docx. Do you want to recover the contents of this document? If you trust the source of this document, click Yes.

To confirm it's such elements which create the issue, retry the import with following import script:

export default {
  transformDOM: ({ document }) => {
    const main = document.body;

    // remove all anchor links
    main.querySelectorAll('a[href^="#"]').forEach((el) => el.remove());

    return main;
  },
};

=> The generated docx is OK.

Expected behavior
If such anchor links are not supported, they should be modified/fixed by default

Version:
16.3.15

@catalan-adobe catalan-adobe added the bug Something isn't working label May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant