chore(backend): satisfy cargo fmt

`checks.yml` runs `cargo fmt --check`, and it has been failing since the round-1
audit fixes: I gated those on `cargo build` and `cargo clippy` but never ran fmt,
so three files drifted then and eight more this round. Pure formatting — no
behaviour change; clippy stays at zero and all 70 backend tests still pass.

Worth noting for next time: clippy passing is not evidence fmt does.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
fabi
2026-07-28 21:26:28 +02:00
parent c49bf875d9
commit 117c0c547f
5 changed files with 39 additions and 28 deletions

View File

@@ -760,9 +760,7 @@ async fn stream_media_file(
.len();
let range = parse_range(
req_headers
.get(header::RANGE)
.and_then(|v| v.to_str().ok()),
req_headers.get(header::RANGE).and_then(|v| v.to_str().ok()),
len,
);
@@ -789,10 +787,7 @@ async fn stream_media_file(
let span = end - start + 1;
base(StatusCode::PARTIAL_CONTENT)
.header(header::CONTENT_LENGTH, span)
.header(
header::CONTENT_RANGE,
format!("bytes {start}-{end}/{len}"),
)
.header(header::CONTENT_RANGE, format!("bytes {start}-{end}/{len}"))
.body(Body::from_stream(ReaderStream::new(file.take(span))))
.map_err(|e| AppError::Internal(e.into()))
}
@@ -838,7 +833,14 @@ pub async fn get_original(
// Full-res original: never cache at the edge, so a takedown revokes access promptly.
// Range requests still work under no-store; the client simply re-fetches each range.
stream_media_file(&headers, &absolute, media.mime_type, &disposition, "no-store").await
stream_media_file(
&headers,
&absolute,
media.mime_type,
&disposition,
"no-store",
)
.await
}
/// Streaming access to an upload's compressed **preview** image. Gated exactly like
@@ -980,13 +982,22 @@ mod tests {
#[test]
fn start_past_eof_is_416_not_a_full_body() {
// Answering 200 here makes a player re-request forever.
assert_eq!(parse_range(Some("bytes=100-"), 100), RangeSpec::Unsatisfiable);
assert_eq!(parse_range(Some("bytes=200-300"), 100), RangeSpec::Unsatisfiable);
assert_eq!(
parse_range(Some("bytes=100-"), 100),
RangeSpec::Unsatisfiable
);
assert_eq!(
parse_range(Some("bytes=200-300"), 100),
RangeSpec::Unsatisfiable
);
}
#[test]
fn inverted_range_is_unsatisfiable() {
assert_eq!(parse_range(Some("bytes=50-10"), 100), RangeSpec::Unsatisfiable);
assert_eq!(
parse_range(Some("bytes=50-10"), 100),
RangeSpec::Unsatisfiable
);
}
#[test]