[BUG] Default file constraints reject documented audio/video MIME types

未关闭
#9,752 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@Kiko0301 已经在做这个了。

开始于 2026年11月25日。

  • #9757 来自 @Kiko0301 —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
python
领域
backend

调研方向

Start in lib/crewai-files/src/crewai_files/processing/constraints.py at DEFAULT_AUDIO_FORMATS (line 40) and DEFAULT_VIDEO_FORMATS (line 61), and compare them with the AudioMimeType and VideoMimeType literals in ../core/types.py plus the AudioFile/VideoFile docstrings. Run the issue's reproduction snippet against validate_audio and validate_video to see the rejections. Done means every modelled/docstring MIME type passes the default constraints, with tests updated accordingly. Note an open pull request (#9757) already targets this, so check its state first.

由索引模型根据 Issue 内容生成。

描述

Description

DEFAULT_AUDIO_FORMATS and DEFAULT_VIDEO_FORMATS (lib/crewai-files/src/crewai_files/processing/constraints.py:40 and :61) are the format lists used by every AudioConstraints/VideoConstraints that does not override supported_formats (OpenAI Responses and Azure audio, and the default constraints in general). They are narrower than the MIME types the library models and documents:

  • AudioMimeType (lib/crewai-files/src/crewai_files/core/types.py) includes audio/x-wav, audio/mp4, audio/x-ms-wma, audio/aiff and audio/opus; the AudioFile docstring advertises M4A, WMA and AIFF. DEFAULT_AUDIO_FORMATS has none of them except audio/m4a.
  • In particular audio/x-wav - the content type Python's mimetypes reports for .wav on Windows - is rejected although audio/wav is accepted.
  • VideoMimeType includes video/x-msvideo (AVI), video/x-matroska (MKV), video/x-flv and video/x-ms-wmv; the VideoFile docstring advertises AVI, MKV, FLV and WMV. DEFAULT_VIDEO_FORMATS has none of them.

validate_audio / validate_video reject any file whose detected content type is not in supported_formats with UnsupportedFileTypeError, so a documented, modelled format is refused before the provider ever sees it. FLAC can also be reported as audio/x-flac, which the AudioMimeType literal itself does not model.

Steps to Reproduce

from types import SimpleNamespace
from crewai_files.processing.constraints import AudioConstraints, VideoConstraints
from crewai_files.processing.validators import validate_audio, validate_video

wav = SimpleNamespace(read=lambda: b"RIFF", filename="meeting.wav", content_type="audio/x-wav")
validate_audio(wav, AudioConstraints(max_size_bytes=10 * 1024 * 1024))

avi = SimpleNamespace(read=lambda: b"RIFF", filename="demo.avi", content_type="video/x-msvideo")
validate_video(avi, VideoConstraints(max_size_bytes=10 * 1024 * 1024))

The first call raises UnsupportedFileTypeError: Audio format 'audio/x-wav' is not supported. ... and the second does the same for video/x-msvideo, although both are valid types the library models.

Expected Behavior

The default constraints accept every MIME type listed in the AudioMimeType / VideoMimeType literals and advertised by the AudioFile / VideoFile docstrings, so a documented format is not rejected by the default validation path.

AI assistance

I used an AI coding agent to investigate, reproduce, and prepare this report, and reviewed its results. Per CONTRIBUTING.md, please apply the llm-generated label; external contributors cannot add it with my current permissions.

主要语言
Python
星标
61.2k
派生
9.2k
平均合并
1 天 14 小时
30 天内合并 PR
180

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

crewAIInc/crewAI 的其他 Issue

查看 crewAIInc/crewAI 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。