fix(tools): bound download response size for drive/slack/onedrive#5414
Conversation
Google Drive, Slack, and OneDrive download routes fetched provider file content without a response size cap, unlike the SharePoint download route. Add maxResponseBytes to each content fetch, reject Google Drive files whose metadata size already exceeds the cap before starting the download, and map the resulting size-limit error to a clean 413 response.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview Google Drive additionally rejects regular binary downloads when Drive metadata Oversized responses surface as 413 via Reviewed by Cursor Bugbot for commit 5d331fb. Configure here. |
Greptile SummaryThis PR adds a
Confidence Score: 5/5Safe to merge — the change is a narrow, additive guard that applies a consistent size-bounding pattern to three previously unbounded download routes. All three routes receive the same treatment used by SharePoint: a stream-size cap on the content fetch and a 413 mapping in the catch block. Google Drive additionally gains a metadata-driven pre-flight check that stops the download before any bytes are transferred. The logic is straightforward, the helpers are well-tested shared utilities, and the new test files exercise the key paths. No regressions are introduced on the success path. No files require special attention. All three route files and their corresponding tests are consistent and correct. Important Files Changed
Reviews (2): Last reviewed commit: "fix(tools): bound download response size..." | Re-trigger Greptile |
|
@greptile review |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 5d331fb. Configure here.
Summary
maxResponseBytes: MAX_FILE_SIZEto every content-downloadsecureFetchWithPinnedIPcall in these three routes (metadata fetches are small JSON and unaffected).413in each route's catch block, matching the existing pattern ingoogle_slides/export-presentation.Test plan
route.test.tsfor all three routes: normal file under cap succeeds, oversized streamed response returns 413, Google Drive oversized metadata size is rejected before content fetch, Google Workspace exports proceed without a metadata size.bun run vitest runon all three new test files — 8/8 passbun run type-checkbunx biome checkbun run check:api-validation