mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-11 06:30:03 +00:00
fix(producer): classify JSON error bodies as non-media sources too
A source that answers with a JSON error body still reached ffprobe and
produced `moov atom not found`. Replicate returns
`{"detail": "requested file not found"}` for a dead asset, and a gateway
in front of it can relay that body with a success status.
The sniff now treats `<`, `{`, or `[` as the opening byte of a text
document. No supported container starts with any of them, so this is the
same trade as before: three bytes instead of an allowlist that grows one
entry per payload shape observed in production.
Renamed accordingly, since the class now covers JSON as well as markup:
MARKUP_NOT_MEDIA -> NOT_MEDIA_PAYLOAD, MarkupNotMediaError ->
NotMediaPayloadError, markupPayload.ts -> notMediaPayload.ts. Registry
entries in the Lambda name map, the CDK and SAM plan lists, the Cloud Run
set, and SAFE_RENDER_ERROR_CODES move with it.
Also documents the reachability boundary on the error class: only a 2xx
response gets here. `downloadToTemp` rejects 404/410 as `http_not_found`
before writing a byte, and every ffprobe input is local because
videoFrameExtractor downloads http srcs first. So the shapes this
classifies are soft-404 and interstitial HTML, S3/CloudFront error
documents, and JSON API error bodies -- each served with a success
status. A genuine 404 surfaces as a download failure, not as this error.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
f3689c1481
commit
349c066a83
@@ -274,12 +274,12 @@ export {
|
||||
} from "./utils/ffprobe.js";
|
||||
|
||||
export {
|
||||
MARKUP_NOT_MEDIA,
|
||||
MarkupNotMediaError,
|
||||
assertNotMarkupPayload,
|
||||
NOT_MEDIA_PAYLOAD,
|
||||
NotMediaPayloadError,
|
||||
assertMediaPayload,
|
||||
fingerprintElementId,
|
||||
isMarkupPayload,
|
||||
} from "./utils/markupPayload.js";
|
||||
isNotMediaPayload,
|
||||
} from "./utils/notMediaPayload.js";
|
||||
|
||||
export { assertPublicHttpsUrl, downloadToTemp, isHttpUrl } from "./utils/urlDownloader.js";
|
||||
export {
|
||||
|
||||
Reference in New Issue
Block a user