Repository navigation
Ask the server which uploads are unused - #110
Merged
Merged
Conversation
"Delete unused files" decided that itself, from the system avatar and member avatars and nothing else. Banners, images embedded in bios and journal entries, and anything revision history still holds were all reported as unused, and the button then deleted them. The server does no reference check of its own on a delete, so nothing downstream caught it. Reproduced on an account whose only two uploads were a member avatar and the live system banner: the old build offered to permanently delete the banner, while the server's own dry run reported no orphans at all. It now asks `POST /v1/files/cleanup/dry-run`, which checks every place a file can be referenced, and matches the result back to the listing by storage key rather than by serve URL, since the URL depends on how the instance hands files out. Deliberately the dry run rather than the real cleanup: that one deletes server-side in one shot and skips System Safety's image category, so deleting the files one at a time from here keeps the safeguard this client already honoured.
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.
From the docs pass. "Delete unused files" decided for itself which uploads were unused, from the system avatar and member avatars and nothing else. Banners, images embedded in bios and journal entries, and anything revision history still holds were all reported as unused, and the button then deleted them. The server does no reference check on a delete, so nothing downstream caught it.
Reproduced on an account whose only two uploads were a member avatar and the live system banner. The old build offered to permanently delete 1 file, which was the banner; the server's own dry run reported no orphans. After the change the screen reads "No unused files found".
It now asks
POST /v1/files/cleanup/dry-run, which checks every place a file can be referenced, and matches the result back to the listing by storage key rather than serve URL, since the URL depends on how the instance serves files. That endpoint has existed since March, so there is no older-server case to handle.Deliberately the dry run rather than
POST /v1/files/cleanup: the real cleanup deletes server-side in one shot and skips System Safety's image category. Deleting one file at a time from here keeps that safeguard, which is the thing this client was already doing right.Two more from the same screen, not fixed here: the storage card reads "514 B of 0 B used" because the server reports 0 for unlimited, and the export row still says "OpenPlural". Both are queued for the cosmetics batch.