unarr/internal
Deivid Soto 47521effea fix(debrid): fsync before verify to stop NFS write-back truncation
Debrid downloads to a network mount (the prod download dir is an NFS share
at /mnt/nas/peliculas) could fail verification with "size mismatch:
expected N, got M" where the file on disk was smaller than the bytes
streamed. Every Write() succeeded into the client page cache (progress
reached 100%) but the function returned before the asynchronous write-back
to the NAS completed, so the caller's verify() stat'd a half-flushed file
and rejected it. Concurrent downloads to the same mount made the contention
worse; a lone retry succeeded because there was no flush pressure.

- fsync the file (file.Sync) and check the error before reporting success,
  so a write-back failure surfaces here instead of silently truncating.
- Stop swallowing the file.Close() error via a guarded close: error paths
  still clean up through defer, the success path closes explicitly and
  inspects the error.
- Guard against a premature end-of-stream (downloaded < Content-Length).
- Safety-net re-stat after the flush: if the on-disk size is short, remove
  the corrupt partial and return a retryable error. This is also the only
  integrity check when the server sends no Content-Length.

Add TestDebridDownloadTruncatedStream.
2026-06-15 17:11:48 +02:00
..
acme feat(agent): per-agent direct-TLS cert client + HTTPS listener wiring 2026-06-05 12:09:46 +02:00
agent feat(downloads): ordered preferred_methods list honored for web tasks 2026-06-14 12:51:32 +02:00
arr feat(cli): upgrade command, rich status, and version cache 2026-03-31 22:05:43 +02:00
cmd chore(release): 1.1.5-beta 2026-06-14 13:25:56 +02:00
config feat(downloads): ordered preferred_methods list honored for web tasks 2026-06-14 12:51:32 +02:00
engine fix(debrid): fsync before verify to stop NFS write-back truncation 2026-06-15 17:11:48 +02:00
funnel feat(subtitles): subtitle-fetch jobs vía sync + auto-fetch opcional en scan 2026-06-10 14:48:35 +02:00
library feat(library): detección de intro/créditos post-scan (skip segments) 2026-06-12 19:46:07 +02:00
mediaserver feat(cli): upgrade command, rich status, and version cache 2026-03-31 22:05:43 +02:00
parser feat: initial commit — unarr CLI 2026-03-28 11:29:42 +01:00
sentry refactor(sentry): decouple agent import via string-match, rename predicate 2026-05-27 17:03:26 +02:00
ui fix(ci): fix lint errors and pin CI to Go 1.25 2026-03-31 22:15:12 +02:00
upgrade test(upgrade): exercise the real signed checksum flow, not a bypass 2026-06-04 08:47:24 +02:00
usenet fix(agent): surface par2/install/NFS failures instead of degrading silently 2026-06-01 15:52:54 +02:00
vpn feat(subtitles): subtitle-fetch jobs vía sync + auto-fetch opcional en scan 2026-06-10 14:48:35 +02:00