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

オープン 初心者向け
#67,448 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

  • #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のボックスタイプをどのように認識するかを確認し、同じ入力を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分
マージ済み PR(30日)
473

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

anomalyco/opencode のほかの issue

anomalyco/opencode の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。