[19.0][FIX] fs_attachment: don't move a file shared with other attachments - #678
Open
abdulrahman-d1 wants to merge 1 commit into
Open
abdulrahman-d1 wants to merge 1 commit into
abdulrahman-d1 wants to merge 1 commit into
Conversation
Contributor
|
Hi @lmignon, |
With filename obfuscation off, storing or renaming an attachment renames its file. Attachments stored while obfuscation was on share one file per content, so that rename moved the file away from the others and they lost their content. Copy the file when other attachments still use it, and move it only when none does. One grouped query per call counts the attachments on each file. It also covers duplicates created in one call, so the special case for them is gone.
abdulrahman-d1
force-pushed
the
19.0-fix-fs_attachment-shared-file-rename
branch
from
October 5, 2026 16:42
9935cee to
9d365a3
Compare
abdulrahman-d1
marked this pull request as ready for review
October 5, 2026 16:56
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.
Uploading a duplicate file can break an older attachment with the same content. The older attachment stays listed, but its file is gone and it opens empty.
It happens when filename obfuscation was on and is now off:
<name>-<id>-<version>.<ext>.We hit this after an upgrade. Our older attachments were stored under their checksum, and the new setup has obfuscation off.
Example
report.pdf2aae6c35...report.pdfagain2aae6c35..., which no longer existsreport-2-0.pdf2aae6c35...report-2-0.pdf, a copyFix
The module now copies the file when other attachments still use it, and renames it only when none does. Changing an attachment's name follows the same rule. This also covers duplicates created in one call, so I removed the special case that came with #646.
How to test
Assisted By: Claude Fable 5.1