Repository navigation
Remove an album's photomap_index folder when the album is deleted - #435
Merged
Merged
Conversation
Deleting a directory album left its photomap_index folder (embeddings, UMAP cache, thumbnails) behind in the photo folder; only InvokeAI-board albums had their index directory cleaned up. Fixes #433. - Only a folder PhotoMap chose is removed: one named photomap_index, or the board album's per-user index directory. Custom index locations and symlinked index folders are left alone; photos are never touched. - The folder is kept while another album still uses it, compared by os.path.samefile so case-insensitive (macOS) or bind-mount spellings of the same folder are recognised. - Deleting an album that is being indexed is refused with 409: the scan, UMAP fit and final save never check the cancel flag and would recreate the folder after it was removed. - rmtree runs off the event loop; an unknown album now gets 404 rather than a 500 wrapping it. - The delete confirmation says the index goes too, and a failed delete shows the server's reason. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes #433.
Problem
Deleting a directory album left its
photomap_indexfolder (embeddings, UMAP cache, thumbnails, scan bookkeeping) behind inside the user's photo folder. Only InvokeAI-board albums had their derived index directory cleaned up.Fix
DELETE /delete_album/{key}now removes the album's index directory, under these rules:photomap_index(the name the album form fills in) or the board album's per-user index dir. Custom index locations and symlinked index folders are left alone. Photos are never touched.os.path.samefile. Comparing path strings misses case-insensitive spellings on macOS and bind mounts.photomap_index.rmtreeruns off the event loop, since a thumbnail directory can be large or on a network share.Frontend: the delete confirmation says the search index is removed too and photos are not touched. A failed delete shows the server's reason via
errorDetail(). Theutils.jsmocks in five Jest suites gainederrorDetailaccordingly.Testing
tests/backend/test_delete_album_index.pycovers: removal; a shared index kept until its last user is deleted; custom location untouched; 409 while indexing; never-indexed album; unknown album 404; a second spelling (symlinked parent) of a shared folder.🤖 Generated with Claude Code