[Bug]: Original file version of Word .docx file corrupt after restoring it from file version history; file versions disappear #49125
Description
⚠️ This issue respects the following points: ⚠️
- This is a bug, not a question or a configuration/webserver/proxy issue.
- This issue is not already reported on Github OR Nextcloud Community Forum (I've searched it).
- Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- I agree to follow Nextcloud's Code of Conduct.
Bug description
When the original version of a .docx file is restored from version history, downloaded and opened in MS Word, there is an error about the file being corrupted. It can then be restored easily in MS Word.
Further Investigation:
I created a few additional versions of the original file by slightly modifying the content and uploading it using the same name an location again. I randomly restored different versions, downloaded them and compared their hashes.
Observations:
- When restoring the original file the first and second time, it has a different hash than the original file
- When restoring the original file the third time, it has its original hash again. For this file, MS Word also doesn't complain anymore
- When restoring different versions and downloading them, sometimes MS Edge reports that these files cannot be downloaded. They are however stored in my "Downloads" folder with a .crdownload file extension AND have their expected file hashes.
Get-FileHash * | sort -Property Path
Algorithm Hash Path
--------- ---- ----
SHA256 7A0325585A963A3CE9DFA400EB99E3E917AEF05B0FDE27CA23E3E67520F2245A .\original.docx
SHA256 DFDCF4C6B9DF4A2970221B82A74E7B90CDA7503F6E21781E83A38B85E9494F2B .\originalRestored.docx
SHA256 DFDCF4C6B9DF4A2970221B82A74E7B90CDA7503F6E21781E83A38B85E9494F2B .\originalRestoredAgain.docx
SHA256 7A0325585A963A3CE9DFA400EB99E3E917AEF05B0FDE27CA23E3E67520F2245A .\originalRestoredAgainAgain.docx
SHA256 084FF1136744E5C87AD79B505099168DF9C63CF2D5DF250EE1C4E49709086A16 .\v1.docx
SHA256 084FF1136744E5C87AD79B505099168DF9C63CF2D5DF250EE1C4E49709086A16 .\v1Restored.crdownload
SHA256 084FF1136744E5C87AD79B505099168DF9C63CF2D5DF250EE1C4E49709086A16 .\v1Restored.docx
SHA256 6BF6829680E47037CD1C3A33C3CCBD54751A92874EC3EB5A48959B263EE7D227 .\v2.docx
SHA256 6BF6829680E47037CD1C3A33C3CCBD54751A92874EC3EB5A48959B263EE7D227 .\v2Restored.crdownload
SHA256 55B9713EC14B045E246E8EDEBE550C04768ECCA160FC087F27AEF31186AA7118 .\v3.docx
SHA256 55B9713EC14B045E246E8EDEBE550C04768ECCA160FC087F27AEF31186AA7118 .\v3Restored.crdownload
I repeated the procedure for a new word file created with Word 2016 to check if my original file was causing the issues:
- I uploaded the file and replaced it consecutively with different versions without restoring or touching it otherwise in between the uploads
- After having created 4 versions including the original, I tried to restore the original version
- It failed with an nextcloud error reading like "File version could not be restored" (was german)
- While restoring different versions of the file, some versions just disappeared from the file version history
Steps to reproduce
- Upload a .docx file
- Edit the file locally with MS Word
- Upload the edited file again using the same name and location
- Choose to keep the new file, which creates a new version of the file
- Restore the original file from the versions tab
- Download the restored original file
- Open the file locally with MS Word and/or compare its hash with the local original file
Expected behavior
The original version of the file can be opened in MS Word without errors.
The restored version has the same file hash as the original version.
Nextcloud Server version
30
Operating system
None
PHP engine version
None
Web server
None
Database engine version
None
Is this bug present after an update or on a fresh install?
None
Are you using the Nextcloud Server Encryption module?
Encryption is Enabled
What user-backends are you using?
- Default user-backend (database)
- LDAP/ Active Directory
- SSO - SAML
- Other
Configuration report
No response
List of activated Apps
No response
Nextcloud Signing status
No response
Nextcloud Logs
No response
Additional info
No response
Activity