shouldDownloadAsText corrupts ZIP responses when content-type defined as json or xml is followed by a delimiter (e.g. json-zip)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 84/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript
調査の方向性
src/http/serializers/response/index.jsから始めます。issueには、レスポンスのメディアタイプがテキストとして分類されると記載されています。コンテンツタイプの照合方法を確認してください。列挙されたJSON/XMLおよびアーカイブのメディアタイプについて回帰ケースを追加し、ZIPレスポンスが元のバイト列を保持することを確認してください。JSON/XMLドキュメントが引き続きテキストとして扱われ、列挙されたZIPタイプがバイナリとして処理されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Description
We are experiencing corrupted ZIP downloads when using swagger-client. The issue appears to originate in
A binary response is treated as text when its media type contains json or xml, even if those strings describe files inside an archive rather than the response body itself.
Minimal reproduction
Return a valid ZIP archive with these headers:
HTTP/1.1 200 OK
Content-Type: application/vnd.sdmx.data+json-zip;version=1.0.0
Content-Disposition: attachment; filename="result.zip"
The response body contains valid ZIP bytes for an archive containing one or more JSON files.
Requesting this endpoint through swagger-client causes the response to be processed as text because the media type contains json.
Expected behavior
The response is handled as binary data, and its bytes remain unchanged.
Actual behavior
The response is decoded as text, resulting in a corrupted ZIP archive.
The same issue can affect other archive media types containing json or xml, for example:
application/vnd.sdmx.genericdata+xml-zip;version=2.1
application/vnd.software602.filler.form-xml-zip
Possible fix
Restrict text detection to media types that actually represent JSON or XML documents, or remove the delimiter as the end of the match.
Suggested regression cases:
application/json -> text
application/problem+json -> text
application/xml -> text
application/atom+xml -> text
application/vnd.sdmx.data+json-zip;version=1.0.0 -> binary
application/vnd.sdmx.genericdata+xml-zip;version=2.1 -> binary
application/vnd.software602.filler.form-xml-zip -> binary
application/zip -> binary
A regression test should also verify that binary response bytes remain unchanged.
- 主要言語
- JavaScript
- スター
- 2.7k
- フォーク
- 764
- 平均マージ
- 1日 10時間
- マージ済み PR(30日)
- 8
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
swagger-api/swagger-client のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
swagger-api/swagger-client#4316 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
swagger-api/swagger-client#4212 · リアクション 4 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
swagger-api/swagger-client#4298 · リアクション 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
swagger-api/swagger-client#4233 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
swagger-api/swagger-client#4223 ·
メンテナーはふだん 1 日以内に返信
swagger-api/swagger-client の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
swc-project/swc-ai-issues#414 ·
-
[workshop-sim] Repair: Make Copilot access and billing path decision self-contained in Steps 07/07dオープンfeedback simulation workshop
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
githubnext/gh-aw-workshop#5597 ·
メンテナーはふだん 1 日以内に返信
-
Add: Film Mania PLオープンcheck:passed feeds:add
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
Disabled radio toggle button groups lose checked state対応中かも @vladosskins178 が今日担当しました。 オープンbug confirmed css has-pr v6
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信