ConvertX
ConvertX copied to clipboard
wps import filter incorrectly mapped to "MS Word 97" - fails on real MS Works documents
Description
Converting a .wps (Microsoft Works Word Processor) file to .docx/.rtf fails with:
Error: source file could not be loaded
Failed to convert ./data/uploads/.../file.wps from wps to docx using libreoffice. error: Error: Command failed: soffice --headless --infilter=MS Word 97 --convert-to docx:MS Word 2007 XML ...
Root cause
src/converters/libreoffice.js maps the wps source format to LibreOffice's "MS Word 97" import filter:
wps: "MS Word 97",
This is incorrect - .wps is the Microsoft Works Word Processor format, not MS Word 97/.doc. LibreOffice's soffice CLI rejects a genuine Works document under the Word 97 filter with "source file could not be loaded", even though soffice can perfectly well auto-detect and convert the same file when no --infilter is forced.
Reproduction
- Upload a real
.wps(Microsoft Works) document. - Convert to docx or rtf.
- Job fails: "Failed, check logs"; server log shows the error above.
Confirmed directly on the host running the container:
$ soffice --headless --infilter="MS Word 97" --convert-to docx:"MS Word 2007 XML" --outdir /tmp "file.wps"
Error: source file could not be loaded
$ soffice --headless --convert-to docx:"MS Word 2007 XML" --outdir /tmp "file.wps"
convert /tmp/file.wps as a Writer document -> /tmp/file.docx using filter : MS Word 2007 XML # succeeds
Suggested fix
In src/converters/libreoffice.js, either:
- Set
wps: nullsogetFilters()skips--infilterentirely and LibreOffice auto-detects the format (verified working locally), or - Map it to LibreOffice's actual Works filter name (
"MS Works Document") if forcing a filter is preferred.
Environment
- ConvertX v0.18.0 (ghcr.io/c4illin/convertx:latest)
- Debian GNU/Linux forky/sid container, LibreOffice 26.2.4.2
Happy to open a PR with the one-line fix if useful.