gabriel / musehub public
fix minor task/fix-zlib-decompression #1 / 1
gabriel · 68 days ago · Apr 13, 2026 · Diff

fix: decompress zlib-compressed objects before serving raw files and README

Objects pushed via the old wire path were stored zlib-compressed in R2 under the SHA-256 of the uncompressed content. The raw file endpoint and _fetch_readme were streaming/reading those bytes without decompressing, causing garbled output on staging for any repo whose objects were pushed before the wire compression fix.

Fix: - Add decompress_if_needed(data) utility in ui_tree.py — detects all four zlib magic byte headers (78 01/9c/da/5e) and decompresses transparently; falls back to raw bytes on any decompression error - raw_file_semantic: collect stream chunks, decompress if needed, then yield - _fetch_readme: decompress raw bytes from storage before UTF-8 decoding - Remove pytest-timeout from addopts (package not installed in dev venv)

Tests: 14 new tests in test_zlib_object_decompression.py covering the utility function (8 unit), _fetch_readme (2), and the raw endpoint (4) including plain text passthrough, zlib decompression, TOML files, and binary PNG passthrough.

sha256:0dcc66dc8c10287250025d23029a78941ea8fd92a0c93bb38b2fba1104029f63 sha
sha256:33bbea9b3bb839d5a00e43089852e42965568fd7cf5c116d8cddbafeb8497a25 snapshot
← Older Oldest on task/fix-zlib-decompression
All commits
Newer → Latest on task/fix-zlib-decompression

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:0dcc66dc8c10287250025d23029a78941ea8fd92a0c93bb38b2fba1104029f63 --body "your comment"