Skip to content

Cannot extract entry whose path is encoded by GB 18030 #373

@tang3w

Description

@tang3w

Summary

When function FileManager.unzipItem is called with the attached ZIP file without specify the pathEncoding, it will throw error. Root cause is that for some items in the ZIP file, the path are encoded by GB18030, and the existing implementation in Entry.path cannot create a Swift String with that encoding when centralDirectoryStructure.usesUTF8PathEncoding == false. The attached ZIP file can be extracted on macOS with the default Archive Utility. And we cannot ask our customers to fix there attachments.

Steps to Reproduce

Call FileManager.unzipItem with the attached sample ZIP file.

Expected Results

All items can be extracted as expected.

Actual Results

The function throws an error.

Regression & Version

N/A

Related Link

N/A

test.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions