fix(backend): invalidate thumbnail cache on replace and permanent delete
Replacing a file's content left the old {id}_thumb.jpg / {id}_preview.jpg
in the cache, and the cache-hit fast path kept serving the stale image
forever; permanent deletion left those files orphaned. FileStorage gains
InvalidateCache, which Replace and PermanentDelete now call.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -21,6 +21,10 @@ type FileStorage interface {
|
||||
// Delete removes the file content from storage.
|
||||
Delete(ctx context.Context, id uuid.UUID) error
|
||||
|
||||
// InvalidateCache removes any cached thumbnail/preview for the file so they
|
||||
// are regenerated from the current content on next request.
|
||||
InvalidateCache(ctx context.Context, id uuid.UUID) error
|
||||
|
||||
// Thumbnail opens the pre-generated thumbnail (JPEG). Returns ErrNotFound
|
||||
// if the thumbnail has not been generated yet.
|
||||
Thumbnail(ctx context.Context, id uuid.UUID) (io.ReadCloser, error)
|
||||
|
||||
Reference in New Issue
Block a user