Plain source starting with `let ftype` is attached as video/mp4

未关闭 适合新手
#67,448 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

  • #67449 来自 @qyb156 —— 已关闭,未合并

评估

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

调研方向

从packages/core开始,阅读以@opencode/core/mime导入的MIME检测器;该 issue 中的问题可通过Mime.detect(Buffer.from("let ftype = 1\n"))复现。检查它如何识别 ISO-BMFF box 类型,并将结果与使用kind处理相同输入时的结果进行比较。完成标准是:JavaScript 源码被检测为text/plain,而实际的视频文件仍能正确识别。

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

描述

area/core platform/macos status/repro-simulated type/bug version/v2
Description

Attaching a JavaScript file whose first line is let ftype = "text/plain" labels the file as video/mp4. A session selecting a line from the file then retains the whole attachment. Request preparation for a text-only model replaces the attachment with “Cannot read … this model does not support video input.”

OpenCode version

Reproduced against dev at 484289a4e8. The MIME detector is identical in v2.4.3.

Steps to reproduce
  1. In a checkout of OpenCode, run bun install --frozen-lockfile and change to packages/core.
  2. Run bun -e 'import { Mime } from "@opencode/core/mime"; console.log(Mime.detect(Buffer.from("let ftype = 1\n")))' .
  3. The result is video/mp4. Changing ftype to kind returns the expected text/plain.

The four letters ftyp in the variable name land where an ISO-BMFF file would store its box type.

Operating System

macOS, arm64, Bun 1.4.4.

主要语言
TypeScript
星标
230k
派生
31.3k
平均合并
5 小时 59 分钟
30 天内合并 PR
473

环境准备

从这里开始

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

anomalyco/opencode 的其他 Issue

查看 anomalyco/opencode 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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