Skip to content

Fix docx writer: skip directory entries when building media overrides#11379

Merged
jgm merged 3 commits intojgm:mainfrom
Harryoung:fix-docx-media-override
Jan 7, 2026
Merged

Fix docx writer: skip directory entries when building media overrides#11379
jgm merged 3 commits intojgm:mainfrom
Harryoung:fix-docx-media-override

Conversation

@Harryoung
Copy link
Contributor

Problem

Pandoc docx writer adds an <Override> for /word/media/ in [Content_Types].xml when the reference doc contains media, which violates OPC rules and causes Word to report corruption.

Fix

Filter out directory entries when building media overrides so only real files produce Override nodes.

Tests

  • Added a minimal regression test to ensure [Content_Types].xml does not contain /word/media/ override when using a reference doc with media.

Related Issue

@Harryoung Harryoung force-pushed the fix-docx-media-override branch from d6ba70f to c545d2b Compare January 5, 2026 01:13
Comment on lines +92 to +95
setTranslations "en-US"
mblang <- toLang (Just (Text.pack "en-US") :: Maybe Text)
maybe (return ()) setTranslations mblang
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your feedback. You're right that the previous change introduced unnecessary complexity. I have now updated the code and removed the extra dependency.

@jgm jgm merged commit c0b6660 into jgm:main Jan 7, 2026
8 of 11 checks passed
@jgm
Copy link
Owner

jgm commented Jan 7, 2026

Thanks!

@Harryoung Harryoung deleted the fix-docx-media-override branch January 7, 2026 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants