Repository navigation
视频按文件头识别:标成图片的 mp4 也转成视频 - #32
Merged
Merged
Conversation
Clients that send every attachment as image_url label a video image/png or image/jpeg. videoBlock only turned image blocks whose media_type said video/* into video blocks, so such a video reached upstream's image check and got 400 "an image whose data is not an image (first bytes: 0000001c66747970)" (seen on px-5, 11-30, an AsyncOpenAI client). Base64 image blocks and data: URLs are now sniffed for an mp4/mov/webm/avi header first. patch-e2e: a video labelled image/png and one in a data:image/jpeg URL are staged for view_file; both were 400 before this change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
有的客户端把所有附件都写成
image_url,视频也标成image/png、image/jpeg。之前videoBlock只把声明为video/*的图片块转成视频块,这种视频会落到上游的图片检查,回 400an image whose data is not an image (first bytes: 0000001c66747970)(11-30 px-5 上一个 AsyncOpenAI 客户端)。现在 base64 图片块和
data:链接先看文件头(mp4/mov/webm/avi),是视频就转成video块,交给上游的view_file。真图片不受影响;HEIC/AVIF 这类 ftyp 图片照旧不算视频。测试:
fork/fork.sh test,patch-e2e 18/18(新增标成 image/png 和 data:image/jpeg 的 mp4 两条,改前都是 400);上游 bun test 的失败项与上游快照相同。合并后版本为 0.1.178(含上游 0.1.176–0.1.178)。
🤖 Generated with Claude Code