Skip to content

Possible regression from 1.2.0 to 1.2.1 when ZIP entry's filename contains backslash #324

Closed
@Capncavedan

Description

@Capncavedan

I experienced an issue with rubyzip last Fall where a customer-supplied ZIP had backslashes instead of forward-slashes for all the directory separators; I resolved it at the time by updating from rubyzip 0.9.9 to 1.2.0. It translated the backslashes to forward slashes e.g. directory separators on OS X and Linux. (0.9.9 behaved "correctly" on OS X but not on Linux).

The recent update to 1.2.1 has changed behavior on Linux such that the backslash is considered part of the filename again. OS X continues to exhibit what I would consider to be the desired behavior, treating backslashes as directory separators. See below.

➜  zipinfo file-with-backslashes-in-path.zip
Archive:  file-with-backslashes-in-path.zip
Zip file size: 200 bytes, number of entries: 1
-rw-r--r--  3.0 unx        6 tx stor 16-Nov-30 19:44 sample\sample_file.txt
1 file, 6 bytes uncompressed, 6 bytes compressed:  0.0%

# with rubyzip 1.2.1:
> src = ::Zip::File.new "file-with-backslashes-in-path.zip"
> src.entries.first.name
=> "sample\\sample_file.txt"

# with rubyzip 1.2.0:
> src = ::Zip::File.new "file-with-backslashes-in-path.zip"
> src.entries.first.name
=> "sample/sample_file.txt"

Is this change in behavior from 1.2.0 to 1.2.1 intentional? Would you consider it a bug that it behavior is different from Linux to OS X?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions