Manuscript (Case [Issue]22575) _Inbox - GZipReadStream class>>#unzip:to: results in an 'Invalid utf8 input detected' error

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Manuscript (Case [Issue]22575) _Inbox - GZipReadStream class>>#unzip:to: results in an 'Invalid utf8 input detected' error

Pharo Issue Tracker
Manuscript Notification
avatar
Bug in Project:  _Inbox: Undecided  •  You are subscribed to this case
In the latest Pharo 7 build GZipReadStream class>>#unzip:to: results in an Invalid utf8 input detected error. In Pharo 6.1 it doesn't. Probably caused by the filestream changes of Pharo 7. Updating the method has fixed the issue for me:

unzip: fullFileName to: pathName
    "Unzip the contents of the file specified by the full path name or file reference fullFileName to the location given by pathName.
    GZipReadStream unzip:'/aPath/zip.gz' to: '/aPath'
    GZipReadStream unzip:'zip.gz' to: '/aPath'
    GZipReadStream unzip:'/aPath/zip.gz' asFileReference to: '/aPath' asFileReference
    
    To unzip a .zip go to the class ZipArchive
    "

    | buffer newName |
    newName := fullFileName asFileReference basename copyUpToLast: FileSystem disk extensionDelimiter.
    pathName asFileReference ensureCreateDirectory / newName
        binaryWriteStreamDo: [ :unzipped | 
            unzipped ifNil: [ self error: pathName , ' looks incorrect' ].
            self
                with: fullFileName asFileReference binaryReadStream
                do: [ :zipped | 
                    buffer := ByteArray new: 50000.
                    [ zipped atEnd ] whileFalse: [ unzipped nextPutAll: (zipped nextInto: buffer) ] ] ].
    ^ newName
Priority Priority: 5 – Fix If Time Status Status: Work Needed
Assigned To Assigned to: Everyone Milestone Milestone: Later

Go to Case
No longer need updates? Unsubscribe from this case.

Don't want Manuscript notifications anymore? Update your preferences.

Manuscript

_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
https://lists.gforge.inria.fr/mailman/listinfo/pharo-bugtracker