Skip to content

fix(thumb): drop credentials on cross-host redirects and bound thumbnail work - #265

Open
xsahil03x wants to merge 4 commits into
mainfrom
fix/thumbnail-redirects-and-limits
Open

xsahil03x wants to merge 4 commits into
mainfrom
fix/thumbnail-redirects-and-limits

Conversation

@xsahil03x

@xsahil03x xsahil03x commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Part of FLU-1382

What

  • Redirects with headers: a network source with headers has its redirects followed in Dart first, and the platform fetches the final URL. On a redirect to another scheme, host or port, the Authorization, Cookie and Proxy-Authorization headers are dropped and the rest are kept, as OkHttp and Go's net/http do. Android also sets its media stack's cross-domain redirect switch. Windows never sends headers, and on web the browser follows redirects itself.
  • Size: a thumbnail is at most 4096 px on its longest side, including when maxWidth and maxHeight are 0. A video more than 8192 px on a side fails with THUMBNAIL_ERROR.
  • Concurrency: at most three thumbnails are generated at a time. One that takes longer than a minute (a minute per video for thumbnailFiles) fails with THUMBNAIL_ERROR and frees its place, using package:pool.
  • Linux: network reads time out after 30 seconds.
  • Android: running out of memory while generating a thumbnail fails with THUMBNAIL_ERROR instead of crashing.

Verified

  • Unit tests (54), including redirect handling against local servers (same host, other host, other port, back to the first host, non-http targets, too many redirects, unreachable servers), the three-at-a-time limit and the one-minute timeout.
  • Integration tests on macOS, the iOS simulator and an Android emulator (API 37): a redirect to another host arrives without Authorization, a same-host redirect keeps every header, small videos keep their size, a 6000 px video comes out at 4096, and a 9000 px video is refused. The 6000 px case is skipped on the emulator, whose software decoder can't decode it at all.
  • Linux and Windows are built by the native-builds workflow; their tests don't run in CI. Web wasn't run.

🤖 Generated with Claude Code

xsahil03x and others added 2 commits November 26, 2026 15:36
…ail work

- Network sources sent with headers have their redirects followed in Dart
  first; a hop to another scheme, host or port drops the Authorization,
  Cookie and Proxy-Authorization headers, and the platform fetches the
  final URL. Android also refuses a later cross-host redirect.
- Thumbnails are at most 4096 px on the longest side, and videos larger
  than 8192 px on a side fail with THUMBNAIL_ERROR.
- At most three thumbnails are generated at a time.
- Linux network reads time out after 30 seconds; Android reports an
  out-of-memory failure as THUMBNAIL_ERROR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A call that never returns held one of the three places for good, so a few
slow network videos could block every other thumbnail. It now fails with
THUMBNAIL_ERROR after a minute and lets the next call start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@xsahil03x
xsahil03x requested a review from a team as a code owner November 26, 2026 14:49
@github-actions github-actions Bot added the ready Pull request ready to be reviewed label Nov 26, 2026
xsahil03x and others added 2 commits November 26, 2026 15:51
Replaces the hand-written task pool with the Dart team's pool package.
Each thumbnail keeps its own one-minute timeout inside withResource, since
the pool's own timeout only fires when nothing at all happens for that long.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…way frames

A batch ran in one place under a single one-minute timeout, so a batch of
slow videos failed together; it now gets a minute per video. On Android,
the full-size frame is released as soon as it has been scaled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

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

Labels

ready Pull request ready to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant