Skip to content

Chat media Download saves HTTP error bodies as image files #3852

Closed

Description

@romanlutz

Describe the bug

The assistant-message media Download handler does not check resp.ok. A 404/500 JSON error response is turned into a Blob and downloaded using the media filename, such as result.png, making an HTTP failure look like a successful image download. The HTML export path already rejects non-OK responses.

Steps/Code to Reproduce

Render MessageList with one assistant image attachment named result.png. Mock its media fetch as a 404 with application/json body {"error":"NOT_FOUND"}, then click Download result.png. The round-20 retained React Testing Library fixture exercises the actual component and intercepts the anchor download.

Expected Results

Do not create a download from an HTTP error response. Show a retryable failure and preserve successful-download behavior.

Actual Results

Both 404 and 500 responses pass their error Blob to URL.createObjectURL and click an anchor with download="result.png". The expected zero-download assertions fail; the successful-200 filename and cleanup control passes.

Screenshots

N/A. Deterministic component test evidence is retained in the QA session artifacts.

Versions

Linux; Node 26.12.1; frontend 1.2.0-dev.0; revision 01ce6ca66a315770b36c7dca1f320668c0d92d7c. JSDOM with deterministic fetch, Blob URL and anchor mocks; no live backend or real browser download.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions