Skip to content

[Bug]: Requesting a thumbnail whose file is gone from storage returns 500 instead of 404 #398

Description

@cancan101

Actual behaviour

When a thumbnail's file is no longer on the thumbnail storage but the thumbnail status cache still reports it as present — a stale cache entry, a file removed from the bucket, a restore that skipped the thumbnail storage — ImageThumbnailTrait::getStream() lets League\Flysystem\UnableToReadFile escape, and the request ends in a 500.

The stale status-cache entry is also left in place, so every subsequent request for that thumbnail produces the same 500 rather than regenerating it.

A related case: when generation itself fails, the caller cannot distinguish "could not generate" from "does not exist", so a failed generation cannot be answered with the placeholder that exists for exactly that purpose.

Expected behaviour

  • A thumbnail whose file is genuinely missing → 404, and the stale status-cache entry invalidated so the next request regenerates it.
  • A read that fails while the file is still there (permission, I/O, backend outage) → surfaced as the storage error it is, not silently regenerated, and the status cache left intact.
  • A failed generation → the placeholder, distinguishable from a missing thumbnail.

Steps to reproduce

  1. Generate a thumbnail so its file and status-cache entry exist.
  2. Delete just the file from the thumbnail storage, leaving the status cache untouched.
  3. Request the thumbnail over the public thumbnail route → 500, repeatedly.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Affected capability

    None yet

    Platform Version

    None yet

    Galaxy

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions