Fix: Delete entry-level file syncs when deleting a thumb asset - #4
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
Conversation
When a thumb asset is set as default, a file sync link is created on the entry (kEntryFileSyncSubType::THUMB) pointing to the thumb asset's file sync. When the thumb asset is later deleted, only the asset-level file syncs are cleaned up. The entry-level file sync link is converted to an independent file by convertLinksToFiles, keeping the thumbnail accessible via the entry's thumbnail URL even after deletion. This fix adds deleteEntryFileSyncsLinkedToAsset() which is called before the thumb asset is soft-deleted. It finds entry-level file syncs that are linked to the thumb asset's file syncs and deletes them first, preventing the link-to-file conversion from preserving stale thumbnail data. Co-Authored-By: bryna.weissman@kaltura.com <bryna.weissman@kaltura.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
Summary
When a thumb asset is deleted via
ThumbAssetService::deleteAction, the entry-level file sync (created bysetAsDefaultThumbAssetviakFileSyncUtils::createSyncFileLinkForKey) remains active. This happens because:deleteActionsoft-deletes the thumb asset (status → DELETED)kObjectDeletedEventtriggerssyncableDeletedwhich deletes the asset-level file syncsdeleteSyncFileForKey, when the source file sync haslinkCount > 0,convertLinksToFiles()converts the entry's LINK file sync into an independent FILE — keeping it with status READYthumbnailAction::execute()still serves the thumbnail because it resolves the file from the entry's file sync (now an independent file)Fix: Added
deleteEntryFileSyncsLinkedToAsset()which is called before the thumb asset is soft-deleted. It:FileSyncObjectType::ENTRY,kEntryFileSyncSubType::THUMB) that havelinked_idpointing to the thumb asset's file syncsconvertLinksToFileswon't preserve stale thumbnail dataReview & Testing Checklist for Human
/thumbnail/entry_id/{id}/version/{version})Notes
deleteActionalready throwsTHUMB_ASSET_IS_DEFAULTif the asset hasTAG_DEFAULT_THUMB)deleteEntryFileSyncsLinkedToAssetmethod queries byLINKED_IDto find entry file syncs that are links to this specific thumb asset, so it won't affect unrelated entry file syncssave()to ensure the entry file syncs are deleted before thekObjectDeletedEventcascade runsconvertLinksToFilesLink to Devin session: https://app.devin.ai/sessions/fdc0eae331b54163b0359394b033c83f
Requested by: @bw-kaltura