Skip to content

Commit

Permalink
Merge pull request #17111 from Rinzwind/revert-ziparchive-readfrom
Browse files Browse the repository at this point in the history
Revert #readFrom: on ZipArchive to use a ZnBufferedReadStream
  • Loading branch information
jecisc authored Sep 14, 2024
2 parents 3c4256d + 4d170fc commit 252ed3b
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/Compression/ZipArchive.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,7 @@ ZipArchive >> readFrom: aStreamOrFile [
| stream name eocdPosition |
stream := aStreamOrFile isStream
ifTrue: [ name := aStreamOrFile printString. aStreamOrFile ]
ifFalse: [
name := aStreamOrFile asFileReference fullName.

"Workaround: Force load the entire contents in memory.
The zip read stream breaks with Zn buffered streams otherwise"
aStreamOrFile asFileReference binaryReadStream contents readStream ].
ifFalse: [ name := aStreamOrFile asFileReference fullName. aStreamOrFile asFileReference binaryReadStream ].
eocdPosition := self class findEndOfCentralDirectoryFrom: stream.
eocdPosition <= 0 ifTrue: [ ZipArchiveError signal: 'can''t find EOCD position' ].
self readEndOfCentralDirectoryFrom: stream.
Expand Down

0 comments on commit 252ed3b

Please sign in to comment.