google-apis-core 1.0 (Faraday): download_dest receives gzip-compressed bytes instead of decompressed content
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 65/100
Direzione di ricerca
Inizia riproducendo il problema con l'esempio download_dest fornito di google-apis-drive_v3, quindi esamina la migrazione di Faraday di google-apis-core 1.0.2 in PR #23524 e il percorso download_dest. Il lavoro è completato quando i download verso StringIO, Tempfile e i percorsi dei file ricevono contenuto binario decompresso invece di byte gzip, mentre export_file continua a funzionare.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Environment details
- Ruby version: 3.3.9
- google-apis-core version: 1.0.2
- google-apis-drive_v3 version: 0.79.0
- faraday version: 2.13+
- OS: Linux (Docker, also reproduced on macOS)
Summary
After upgrading from google-apis-core 0.18.0 (httpclient) to 1.0.2 (faraday), binary file downloads via download_dest receive raw gzip-compressed bytes instead of the decompressed file content. The old httpclient backend handled this transparently via transparent_gzip_decompression.
Steps to reproduce
```ruby
require "google/apis/drive_v3"
require "stringio"
client = Google::Apis::DriveV3::DriveService.new
client.authorization = Google::Auth.get_application_default(["https://www.googleapis.com/auth/drive"])
Download a binary file (e.g., .xlsx) from Google Drive
io = client.get_file("SOME_FILE_ID", download_dest: StringIO.new)
io.rewind
bytes = io.string
puts bytes.encoding #=> UTF-8
puts bytes[0..3].unpack1('H*') #=> "1f8b0800" (gzip magic number)
Expected: "504b0304" (ZIP/XLSX magic number)
```
Expected behavior
download_dest should receive the decompressed file content — the actual XLSX/ZIP binary data with magic bytes PK\x03\x04 (504b0304).
This was the behavior with google-apis-core 0.18.0 using httpclient, which had transparent_gzip_decompression enabled by default.
Actual behavior
download_dest receives raw gzip-compressed bytes (magic bytes \x1F\x8B / 1f8b0800). The content is not decompressed before being written to the IO/file.
This breaks any downstream code that expects the actual file content (e.g., parsing XLSX files with rubyzip or roo):
Zip::Error: Zip end of central directory signature not found
Additional context
- Affects all
download_desttargets: StringIO, Tempfile (binmode), and file path strings all receive gzip-compressed content. - Does not affect
export_file: Text exports (CSV, etc.) viaexport_filework correctly. - The
transparent_gzip_decompressionoption was deprecated in the Faraday migration (PR #23524), but no equivalent decompression was added fordownload_dest. - Workaround: Pin
google-apis-coreto< 1.0to continue using the httpclient backend.
Versions
| Gem | Working | Broken |
|---|---|---|
google-apis-core |
0.18.0 (httpclient) | 1.0.2 (faraday) |
google-apis-drive_v3 |
0.66.0 | 0.79.0 |
Related: PR #23524 (httpclient → faraday migration)
- Lingua principale
- Ruby
- Stelle
- 2.9k
- Fork
- 888
- Merge medio
- 8m
- PR unite (30g)
- 241
Guida per i contributori
Apri 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 googleapis/google-api-ruby-client
-
Please Drop ruby 3.2 support Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
googleapis/google-api-ruby-client#28001 · 5 reazioni ·
-
googleapis/google-api-ruby-client#27757 · 1 assegnatario ·
-
googleapis/google-api-ruby-client#27758 · 1 assegnatario ·
-
googleapis/google-api-ruby-client#27759 · 1 assegnatario ·
-
api: storage type: feature request
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
googleapis/google-api-ruby-client#27339 ·
Tutte le issue di googleapis/google-api-ruby-client
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
hanami/hanami-cli#449 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
resque/resque-scheduler#826 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100