fix: missing docx defaults from llm generated files - #1030
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes handling of missing w:docDefaults elements in DOCX files generated by LLM tools that may omit this required structure. The fix adds graceful fallbacks when document defaults are not present and improves defensive programming to prevent runtime errors.
- Refactored document default style extraction to handle missing XML elements gracefully
- Added defensive null checks and optional chaining throughout DOCX parsing logic
- Added test coverage for DOCX files lacking
w:docDefaultsstructure
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| SuperConverter.js | Major refactor of getDocumentDefaultStyles() method with new helper function and improved error handling |
| w-p-helpers.js | Added defensive programming with optional chaining for missing XML elements |
| font-default-styles.test.js | Added test case for graceful fallback when w:docDefaults is missing |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Collaborator
Author
|
🎉 This PR is included in version 0.22.0-next.3 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
luccas-harbour
pushed a commit
that referenced
this pull request
Sep 26, 2025
* fix: missing docx defaults from llm generated files * fix: protect against missing sectPr in documents from LLMs
harbournick
pushed a commit
that referenced
this pull request
Sep 30, 2025
# [0.22.0](v0.21.0...v0.22.0) (2025-09-30) ### Bug Fixes * context menu bypass standards ([#1029](#1029)) ([99e6bf7](99e6bf7)) * context menu bypass standards ([#1032](#1032)) ([8c80c2c](8c80c2c)) * do not track the annotation deletion on table generation ([#1036](#1036)) ([5e77dd4](5e77dd4)) * import/export of missing pict separators ([#1048](#1048)) ([8320a2c](8320a2c)) * losing selection on right click ([1e66343](1e66343)) * missing docx defaults from llm generated files ([#1030](#1030)) ([de7a2b2](de7a2b2)) * scope editor DOM queries to recover typing latency ([#1033](#1033)) ([7149090](7149090)) * tracked changes don't have corresponding comments ([#1045](#1045)) ([ebead1a](ebead1a)) ### Features * add MS Word fallback sizes to tables from LLM generated docx missing key data ([#1035](#1035)) ([850cc0b](850cc0b)) * **menu:** add custom context menu items functionality ([#988](#988)) ([57e77d9](57e77d9)) * structured content commands ([#1037](#1037)) ([1acf705](1acf705))
Collaborator
Author
|
🎉 This PR is included in version 0.22.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.