Repository navigation
feat(documents): open Word backup copies (.wbk) - #1935
Conversation
A .wbk holds either a DOCX (ZIP with word/document.xml) or, when the original was a .doc, a Word 97-2003 OLE file. The built-in word-backup engine is an IEnvelopeOpener: it reads the first bytes, passes the unchanged copy on as docx or doc, and the planner continues along the usual routes. Anything else is refused with error.wbk_not_word. Preset availability looks through such an opener's inner formats, so 4-step and direct-only DOCX presets stay usable; .p7m is left as it was. Schema v107 teaches existing libraries .wbk. Fixes KnifeLemon#1840 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
KnifeLemon
left a comment
There was a problem hiding this comment.
Thanks, @YusufMntm! I read the whole diff. CI is green on every leg.
What I checked
- Detection: the OLE signature becomes
doc, and a ZIP withword/document.xmlbecomesdocx. Anything else gets its ownerror.wbk_not_word. A refusal never touches an existing output, because the copy goes through a temp file and a move. - Routes: the DOCX case is fully built in. The DOC case uses the existing
doc → …routes and names the package only when it's missing. No new LibreOffice-only path is added, which fits how we handle documents. PresetAvailability: the fallback to the opener's inner formats only applies to un-named envelopes, so.p7mstays as it was. The new test covers the four-step PNG route, direct-only XLSX and Translate.- Names:
Backup of Report.wbk→Backup of Report.pdfis right, since Word doesn't name backups after the file inside. - i18n: the three keys are in all 23 files. The engine name stays in English in the same files as
engine.p7m.name.
Schema number: #1849 and #1774 also use 107. We'll renumber this step (and the 106/107 in WbkFormatTests) when we merge, so there's nothing for you to do.
Your note about the text-shaping replan and the font preflight not looking inside envelopes is fine as a follow-up.
KnifeLemon#1849 took 107. CHANGELOG.md is main's; this PR's lines go in with the maintainers' CHANGELOG catch-up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I merged To stop the open PRs from conflicting on |
main took v108 for Word backup copies (.wbk, KnifeLemon#1935), so 3D Studio models learn the 3D donut in v109 (CurrentSchemaVersion 109, the BuiltInData note and the migration test follow). FormatFieldsTests counts .wbk (General 100) and .3ds (Specialist 146). .3ds is a 2.6.0 format for shared presets (SharedPresetVersions). CHANGELOG.md is main's; this PR's lines go in with the maintainers' CHANGELOG catch-up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
KnifeLemon#1935 took schema step 108 for .wbk, so the .ait step moves to v109. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Lines for KnifeLemon#1381 (macOS updates), KnifeLemon#1698 (portable updates), KnifeLemon#1913, KnifeLemon#1934, KnifeLemon#1915, KnifeLemon#1935, KnifeLemon#1947, KnifeLemon#1864, KnifeLemon#1831, KnifeLemon#1910, KnifeLemon#1918 and KnifeLemon#1919. The contributors' own lines (left out of their PRs to avoid CHANGELOG conflicts) are used where they wrote one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What does this change?
Filee opens Word backup copies (
.wbk, written when Word's "Always create backup copy" is on) and converts them as the document inside. Fixes #1840.As you wrote in the issue, a
.wbkis either an ordinary DOCX or, when the original was a.doc, a Word 97–2003 file, so each file is checked for which one it holds:wbk(Document, grade General likedoc), on the documents donut. Not inFormatRegistry.Envelopes: Word names backupsBackup of Report.wbk, notReport.docx.wbk, soBackup of Report.wbkbecomesBackup of Report.pdf.word-backupengine (Office/WordBackupConverter.cs), anIEnvelopeOpenerlike.p7m's, with edgeswbk → docxandwbk → doc.InnerFormatreads the first 8 bytes:PK\x03\x04withword/document.xmlin the ZIP →docx; the OLE signature →doc. Anything else (empty, random bytes, a ZIP that isn't a Word document) refuses with its own keyerror.wbk_not_wordand no detail. The step copies the file unchanged through a temp file beside the output, then moves it into place, so a refusal never touches an existing output.JobQueue+RoutePlanner.PlanThrough. A DOCX backup gets every built-in and optional DOCX route. A DOC backup goes straight to LibreOffice'sdoc → …edges, and without LibreOffice it fails with the usualdoc → <target>missing-route message, which names the package to install.PresetAvailability):wbk → docx → hwpx → pdf → pngis four steps, more thanPlanallows, anddocx → xlsxisDirectOnly. So with only the direct check, PNG, XLSX and Translate would look unusable for a.wbkeven thoughJobQueue(which plans through the opener) runs them. When the direct check fails, availability now also tries the formats an opener lists for that source..p7mis left exactly as it was: its opener already has an edge to every format, and the newFormatRegistry.IsNamedEnvelopekeeps it out of the fallback.LearnExtensions(profiles, out _, ["wbk"]), like.p7m's v68 step; custom claims stay put. feat(image): colour-mapped previews of single-band rasters #1849 and feat(vector): read Adobe Illustrator templates (.ait) #1774 also ask for 107, so whichever lands later needs the next number. Happy to renumber this one.engine.word-backup.name/.descriptionanderror.wbk_not_wordin all 23 files.docs/ENGINES.mdsection after.p7m, and a CHANGELOG bullet with a ko/en pair.Left out on purpose, to keep this to one thing: the
ITextShapingCheckreplan is skipped for every envelope inJobQueue, so an Arabic or Thai DOCX inside a.wbkisn't moved offrhwpthe way a plain.docxis, and the missing-font preflight (DocumentFonts.PackageExtensions) doesn't look inside a.wbk. Both behave the same for.p7mtoday.Type of change
How was it tested?
dotnet format --verify-no-changes(changed .cs files)dotnet test:WordBackupTests+P7mengine tests (13 passed), the wholeFilee.Core.Tests(1838 passed, 11 skipped), and the App testsPresetAvailabilityTests,OrdinaryConversionNoticeTests,DefaultPlacementTests,LocalizationTests(292 passed)New tests, with inputs built in the test:
WordBackupTests(Engines): a DOCX backup →docx, copied byte for byte with a.docxname; an OLE backup →doc, copied unchanged; empty, random, plain-ZIP and corrupt-ZIP files refuse witherror.wbk_not_word; an existing output survives a refusal;JobQueueend to end,.wbk→ TXT and → Markdown.WbkFormatTests(Core): registration, the documents donut,NameWithoutExtension, and the v107 step (including a custom claim kept).PresetAvailabilityTests.Word_backup_envelope_keeps_four_hop_png_direct_only_xlsx_and_translate_available(App).FormatFieldsTests: General count 99 → 100.I didn't have a real
.wbkfrom Word; the DOCX backups in the tests are made by the test, and the OLE case only checks the signature and the copy. A DOC backup converted through LibreOffice wasn't tried by hand.Checklist
src/Filee.App/Assets/i18n/*.jsonfilesTHIRD-PARTY-NOTICES.md(none)🤖 Generated with Claude Code