Skip to content

Anchor links generate corrupted Word documents #348

Description

@catalan-adobe

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions