You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I'd like to take this one. I maintain Davflare, a FlareDrive derivative, and hit the same problem there.
Root cause: thumbnails are content-addressed (_$flaredrive$/thumbnails/<digest>.png) and intentionally shared between files with identical content, and functions/webdav/delete.ts never cleans them up, so they accumulate as orphans.
Proposed safe solution — per-path reference markers (no counters, no read-modify-write):
On upload/copy (put.ts, multipart create in post.ts, copy.ts): before writing the destination object, PUT an immutable marker object _$flaredrive$/thumbnails/refs/<digest>/<path>.
On delete (delete.ts, file or recursive directory): remove the file's marker, then list refs/<digest>/ — only when no markers remain, delete thumbnails/<digest>.png.
Markers are written before the referencing object and removed before the reference disappears, so a concurrent delete can at worst over-retain a thumbnail (same as today's behavior), never break one that is still in use.
Thumbnails uploaded before this change have no markers, so they are conservatively retained rather than risk breaking duplicates that share them.
Activity
longern commentedon Sep 6, 2024
The thumbnails are shared when copying or uploading duplicate files. I haven't thought of a safe solution to delete the thumbnails yet.
fanchenggang commentedon Sep 6, 2026
Hi! I'd like to take this one. I maintain Davflare, a FlareDrive derivative, and hit the same problem there.
Root cause: thumbnails are content-addressed (
_$flaredrive$/thumbnails/<digest>.png) and intentionally shared between files with identical content, andfunctions/webdav/delete.tsnever cleans them up, so they accumulate as orphans.Proposed safe solution — per-path reference markers (no counters, no read-modify-write):
put.ts, multipart create inpost.ts,copy.ts): before writing the destination object, PUT an immutable marker object_$flaredrive$/thumbnails/refs/<digest>/<path>.delete.ts, file or recursive directory): remove the file's marker, then listrefs/<digest>/— only when no markers remain, deletethumbnails/<digest>.png.Happy to send a PR if this direction sounds good.
fanchenggang commentedon Sep 6, 2026
PR: #43
fix(webdav): 删除文件/目录时按引用计数回收共享缩略图 (longern/FlareDrive#16)