Whole file
uktrade/stream-unzip
The author described this change as “fix: expose size of 0-bytes zipped files”. It counts as a record because the check below fails on the code as it stood at 674617003 and passes on 3a44efa01, with nothing else changed between the two runs.
Projectuktrade/stream-unzip
Fix saved2021-05-18
Sharing licenceMIT · LICENSE
Change size+3 −3
What the code was meant to do, written into the code itself as a save note
fix: expose size of 0-bytes zipped files
The change
| 102 | 102 | if compressed_size == zip64_compressed_size: | |
| 103 | 103 | uncompressed_size, compressed_size = Struct('<QQ').unpack(extra[zip64_size_signature]) | |
| 104 | 104 | ||
| 105 | + | if flags == b'\x08\x00': | |
| 106 | + | uncompressed_size = None | |
| 107 | + | ||
| 105 | 108 | def _decompress_deflate(): | |
| 106 | 109 | dobj = zlib.decompressobj(wbits=-zlib.MAX_WBITS) | |
| 107 | 110 | ||
| ⋯ | |||
| 132 | 135 | uncompressed_bytes = \ | |
| 133 | 136 | read_multiple_chunks(compressed_size) if compression == 0 else \ | |
| 134 | 137 | _decompress_deflate() | |
| 135 | - | ||
| 136 | - | if uncompressed_size == 0: | |
| 137 | - | uncompressed_size = None | |
| 138 | 138 | ||
| 139 | 139 | return file_name, uncompressed_size, uncompressed_bytes | |
| 140 | 140 | ||
The check that tells the two apart
fail→pass·test.py::TestStreamUnzip::test_empty_file
Check file test.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it6746170031ed992cd925e30f1294caaa277bd81d
Broken version dated2021-05-18
Modulestream_unzip
Units changedstream_unzip
Fingerprintf848091bd234779b
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.