fix(media-files): Skip sync when draft files doesn't have a bucket#326
Merged
kpsherva merged 1 commit intoinveniosoftware:masterfrom Mar 10, 2026
Merged
Conversation
* When publishing an edit, `_publish_edit` always calls bucket.sync(), however the method assumes that the draft files manager has a bucket already initialized but if the media files flag is disabled and no files were ever uploaded to the draft, the bucket is not created and the sync errors out.
fdb7a37 to
d2550cc
Compare
ptamarit
reviewed
Mar 10, 2026
Comment on lines
+127
to
+132
| # If the draft files manager has a bucket associated with it, then we need to sync to | ||
| # propagate the changes to the record files manager regardless of whether files are enabled. | ||
| # The sync() method assumes the source file manager has a bucket, so we need to check for it. | ||
| draft_bucket = self.get_record_bucket(draft) | ||
| if draft_bucket: | ||
| record_files.sync(draft_files, delete_extras=True) |
Member
There was a problem hiding this comment.
Can this bug be covered be covered by a test?
Contributor
Author
There was a problem hiding this comment.
The test_multiple_edit test function is is covering this. It has media files disabled. it's the test that was failing before.
ptamarit
approved these changes
Mar 10, 2026
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.
_publish_editalways calls bucket.sync(), however the method assumes that the draft files manager has a bucket already initialized but if the media files flag is disabled and no files were ever uploaded to the draft, the bucket is not created and the sync errors out.Note