shouldDownloadAsText corrupts ZIP responses when content-type defined as json or xml is followed by a delimiter (e.g. json-zip)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 84/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript
Direzione di ricerca
Inizia da src/http/serializers/response/index.js, dove l’issue afferma che i tipi di media delle risposte vengono classificati come testo, e verifica come viene effettuata la corrispondenza del tipo di contenuto. Aggiungi casi di regressione per i tipi di media JSON/XML e di archivio elencati, e verifica che una risposta ZIP mantenga i byte originali. Il lavoro è completato quando i documenti JSON/XML restano testo e i tipi ZIP elencati vengono gestiti come dati binari.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- JavaScript
- Stelle
- 2.7k
- Fork
- 764
- Merge medio
- 1g 10h
- PR unite (30g)
- 8
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di swagger-api/swagger-client
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
swagger-api/swagger-client#4316 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
swagger-api/swagger-client#4212 · 4 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
swagger-api/swagger-client#4298 · 2 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
swagger-api/swagger-client#4233 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
swagger-api/swagger-client#4223 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di swagger-api/swagger-client
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
swc-project/swc-ai-issues#414 ·
-
[workshop-sim] Repair: Make Copilot access and billing path decision self-contained in Steps 07/07dApertafeedback simulation workshop
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
githubnext/gh-aw-workshop#5597 ·
I maintainer di solito rispondono entro 1 giorno
-
Add: Film Mania PLApertacheck:passed feeds:add
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Disabled radio toggle button groups lose checked stateForse già presa @vladosskins178 l’ha presa oggi. Apertabug confirmed css has-pr v6
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno