jaraco / zipp

MIT License
61 stars 53 forks source link

.match honors Windows path separators on Windows #92

Closed jaraco closed 1 year ago

jaraco commented 1 year ago

Considering the match implementation:

https://github.com/jaraco/zipp/blob/7e8ba95957564c9625cf83cb97c82c524cf676cd/zipp/__init__.py#L347

The use of pathlib.Path here means that on Windows, a backslash will match a path separator:

>>> pathlib.Path('foo/bar.txt').match('foo\\*')
True

Perhaps that is undesirable and only posix paths should match (as those are all that are allowed in zip file separators). Perhaps PurePosixPath should be used:

>>> pathlib.PurePosixPath('foo/bar.txt').match('foo\\*')
False