Repository navigation
fix(public-shares): stream shared files with byte ranges instead of buffering them under 100 MB - #9550
Conversation
…uffering them under 100 MB
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
[Medium impact] The PR appears safe to merge; both previous findings are fixed and no new blocking issue was found. SummaryPublic shares now stream stored files beyond the 100 MB buffered limit and support byte-range requests. Pages, generated documents, and image previews keep the buffered path.
|
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
…elivered response, cover both read paths
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
readPublicFileShareContentnow decides once, right after the grant is read and the file is admitted. A file served as its stored bytes (servesStoredBytes, the predicate the serve route uses) comes back as astreamresult; a page, generated document orpreview=1image is built whole exactly as before (bufferresult).open(range)reads the whole object or one inclusive span from storage, then rechecks the grant, the file revision and its secret provenance before handing the stream out, the same guaranteesfinish()gives a buffered read. It reports the delivery and audits once per view (a download, or the first span of a player's ranged reads), not once per seek.createStoredFileStreamResponse(200 / 206 / 304 / 416,Accept-Ranges, strong ETag), keeping the token URL's revalidate cache policy andnosniff. The HEAD check no longer applies the buffered ceiling or the document sniff to files that stream.servesByteRanges, so video and audio on share pages stream and seek instead of downloading the whole file into the tab.Type of Change
Testing
content-sharing.integration.ts(real PostgreSQL + local storage), 13/13: a new check streams a stored object past the 100 MB ceiling (exact full and tail-range bytes), refuses a previously opened read once the share is disabled, and keeps pages and generation sources off the stream. The existing mid-read revocation/password/archive/provenance check now injects the change during either read path. Removing the post-open recheck turns both red.next devwith a real public share of a 151 MB MP4, 11/11: byte-exact full GET, exact 206 slices incl. suffix, 416, 304, HEAD 200, a small text share unchanged, one audit row per view, the/f/<token>viewer playing and seeking and its Download button saving the exact file, and a disabled share refusing a fresh ranged request.lib/public-sharesandapp/api/filesunit suites;check:api-validation:strict,check:comment-hygiene,check:source-conventions,check:client-boundary,check:test-patterns,check:file-names,check:boundaries,check:utils, block registry check, lintbun run test,check:auditsandtype-checkleft to CIChecklist
test-auditauthoring gate)🤖 Generated with Claude Code