Skip to content

fix(remote_video): reject empty Content-Type on GET#2913

Merged
vpetersson merged 1 commit into
masterfrom
reject-empty-content-type
May 19, 2026
Merged

fix(remote_video): reject empty Content-Type on GET#2913
vpetersson merged 1 commit into
masterfrom
reject-empty-content-type

Conversation

@vpetersson
Copy link
Copy Markdown
Contributor

Issues Fixed

Follow-up to #2912.

Description

The remote-video download task accepted Content-Type: '' on GET, with the rationale that ffprobe in the chained normalize step would catch any non-video body. But: if the body did write to disk, the row would still reference the file — so the orphan-cleanup sweep wouldn't touch it, leaving an HTML error page sitting on the SD card as a multi-GB ""asset"".

A missing Content-Type is a stronger signal of a misbehaving origin than evidence of a real video. Reject it the same way we reject text/html / application/json — the operator sees an explicit Failed pill with a clear message instead of a row in a half-state.

  • Tighten _validate_remote_video_response to accept only video/* and application/octet-stream.
  • Add test_download_remote_video_asset_empty_content_type_aborts.
  • Update inline comment on why we no longer accept empty Content-Type.

Checklist

  • I have performed a self-review of my own code.
  • New and existing unit tests pass locally and on CI with my changes.
  • I have done an end-to-end test for Raspberry Pi devices.
  • I have tested my changes for x86 devices.
  • I added a documentation for the changes I have made (when necessary).

A 200 OK with no Content-Type is a stronger signal of a misbehaving
origin than evidence of a real video — and accepting it would let an
HTML error page land on disk as a multi-GB asset that the cleanup
sweep can't recover (the row still references the file, so it isn't
an orphan).

Reject with the same ``unexpected Content-Type`` error path so the
operator sees an explicit Failed pill and a re-upload affordance.

Follow-up to #2912.
@vpetersson vpetersson requested a review from a team as a code owner May 19, 2026 12:28
@vpetersson vpetersson self-assigned this May 19, 2026
@sonarqubecloud
Copy link
Copy Markdown

@vpetersson vpetersson merged commit cfe07ce into master May 19, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant