[v3.8.50] fix(api): defer media body size limits to providers - #8843
Conversation
|
Standalone body-size floor so Media generate / edit stop dying on the 10 MB default without waiting for the full upscale feature. The same change is also on #8791 (plus Adobe Firefly |
|
Re-homed to |
5ed365e to
959e3de
Compare
97ac310 to
97a993e
Compare
Image and video payloads vary by provider and base64 encoding adds substantial overhead. Exempt media routes from OmniRoute's global request-body cap so provider-specific validation determines whether a request is too large. Keep finite body limits for non-media routes and cover both header and streamed-body admission paths.
97a993e to
a94ba22
Compare
|
Merged via local merge-train on 192.168.0.113 (32 cores) @ train tip Green:
For reference, |
45d375a
into
diegosouzapw:release/v3.8.50
Image and video payloads vary by provider and base64 encoding adds substantial overhead. Exempt media routes from OmniRoute's global request-body cap so provider-specific validation determines whether a request is too large. Keep finite body limits for non-media routes and cover both header and streamed-body admission paths.
Summary
413 PAYLOAD_TOO_LARGEresponse for/api/v1/images/*,/api/v1/videos/*, and/api/v1/providers/{provider}/images/generations.Content-Lengthadmission check and the streamed image-edit reader defer size validation to the selected provider.The reported failure happened before provider dispatch in
src/shared/middleware/bodySizeGuard.ts:{"error":{"message":"Request body too large. Maximum allowed: 10 MB","type":"payload_too_large","code":"PAYLOAD_TOO_LARGE"}}Base64 media adds roughly 33% envelope overhead and provider limits vary by model, so OmniRoute's global 10 MB default was not an appropriate authority for image/video payloads.
Related Issues
Validation
node --import tsx/esm --test tests/unit/body-size-guard.test.ts tests/unit/image-generation-route.test.ts— 34/34 passednpm run lint— passednpm run typecheck:core— passednpm run check:changelog-integrity— passedTests Added Or Updated
tests/unit/body-size-guard.test.tsNumber.MAX_SAFE_INTEGERinContent-Lengthcannot produce OmniRoute's mediaPAYLOAD_TOO_LARGEresponse;tests/unit/image-generation-route.test.tsCoverage Notes
The focused suites cover direct media and provider-specific image-generation matching in
src/shared/middleware/bodySizeGuard.tsthrough both consumers,checkBodySize()andreadRequestBodyWithLimit(), plus the real image-edit route. No coverage was removed.Reviewer Notes
This removes only OmniRoute's own media admission cap. Runtime/framework constraints and each upstream provider's native validation still apply. Non-media protections are unchanged.