Make CleanupUploadFilesJob skip tenant upload dirs (#842)#851
Merged
aprilrieger merged 3 commits intomainfrom Mar 19, 2026
Merged
Make CleanupUploadFilesJob skip tenant upload dirs (#842)#851aprilrieger merged 3 commits intomainfrom
aprilrieger merged 3 commits intomainfrom
Conversation
…t CleanupUploadFilesJob never runs for tenant UUID dirs,uploaded_collection_thumbnails, identity_provider, or hyrax (UploadedFilecache). Only hex pair-tree dirs (00-ff) are cleaned
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.
Ref ticket #842
Summary
CleanupUploadFilesJob was enqueueing CleanupSubDirectoryJob for every top-level directory under the uploads path, including tenant UUID directories that hold permanent site/branding files (e.g. site/banner_images/). That could delete banner images and other tenant assets.
Changes
CleanupUploadFilesJob only considers top-level directories whose basename is exactly two hex characters (00–ff). Those are the pair-tree staging dirs used for temporary work uploads; all other top-level dirs are left alone.
Introduced HEX_TOP_DIR_PATTERN and restricted top_level_directories to paths that are directories and whose basename matches this pattern.
When enqueueing CleanupSubDirectoryJob, the job now passes uploads_path for use in validation.
Protected directories (never cleaned)
The job only processes hex dirs; these are never passed to CleanupSubDirectoryJob:
Specs
Acceptance criteria
[x] CleanupUploadFilesJob does not create a CleanupSubDirectoryJob for tenant/branding directories (e.g. …/56e0eb81-.../site/banner_images/).
[x] Specs document and enforce that uploaded_collection_thumbnails, identity_provider, and hyrax top-level dirs are also never cleaned.