Skip to content

Restore support for special filenames - #124

Merged
jaraco merged 10 commits into
mainfrom
bugfix/gh-123270-supported-names
Aug 26, 2024
Merged

jaraco merged 10 commits into
mainfrom
bugfix/gh-123270-supported-names

Conversation

@jaraco

@jaraco jaraco commented Aug 26, 2024 •

Copy link
Copy Markdown
Owner
@jaraco
jaraco force-pushed the bugfix/gh-123270-supported-names branch from 3798bb6 to 3eb3ff9 Compare August 26, 2024 14:39
@jaraco
jaraco force-pushed the bugfix/gh-123270-supported-names branch from 3eb3ff9 to 0a3a7b4 Compare August 26, 2024 14:42
@jaraco

jaraco commented Aug 26, 2024 •

Copy link
Copy Markdown
Owner Author

That's interesting. The new backslash_is_not_separator test is failing on Windows:

____________________ TestPath.test_backslash_not_separator ____________________

self = <tests.test_path.TestPath testMethod=test_backslash_not_separator>

    def test_backslash_not_separator(self):
        """
        In a zip file, backslashes are not separators.
        """
        data = io.BytesIO()
        zf = zipfile.ZipFile(data, "w")
        zf.writestr("foo\\bar", b"content")
        zf.filename = ''
        root = zipfile.Path(zf)
        (first,) = root.iterdir()
>       assert not first.is_dir()
E       AssertionError

tests\test_path.py:634: AssertionError

It's not immediately obvious to me why.

@obfusk

obfusk commented Aug 26, 2024

Copy link
Copy Markdown

That's interesting. The new backslash_is_not_separator test is failing on Windows:

Oh yeah, ZipInfo.__init__() calls _sanitize_filename(), which will replace os.sep with /.

@jaraco

jaraco commented Aug 26, 2024

Copy link
Copy Markdown
Owner Author

Oh yeah, ZipInfo.__init__() calls _sanitize_filename(), which will replace os.sep with /.

I confirmed the same. I wonder if it's possible to construct a ZipFile with backslashes on Windows.

@jaraco

jaraco commented Aug 26, 2024

Copy link
Copy Markdown
Owner Author

Oh yeah, ZipInfo.__init__() calls _sanitize_filename(), which will replace os.sep with /.

I confirmed the same. I wonder if it's possible to construct a ZipFile with backslashes on Windows.

Looks like I can maybe overwrite the .filename after construction.

@jaraco
jaraco force-pushed the bugfix/gh-123270-supported-names branch from 7708409 to a421f7e Compare August 26, 2024 15:14
@jaraco
jaraco marked this pull request as ready for review August 26, 2024 15:44
@jaraco
jaraco force-pushed the bugfix/gh-123270-supported-names branch from 1cb70be to cc61e61 Compare August 26, 2024 15:47
@jaraco

jaraco commented Aug 26, 2024

Copy link
Copy Markdown
Owner Author

@obfusk, any comments before I merge and cut a release?

@obfusk

obfusk commented Aug 26, 2024

Copy link
Copy Markdown

LGTM 👍

@jaraco
jaraco merged commit c2b9015 into main Aug 26, 2024
@jaraco
jaraco deleted the bugfix/gh-123270-supported-names branch August 26, 2024 17:24
jaraco added a commit to jaraco/cpython that referenced this pull request Aug 26, 2024
jaraco added a commit to jaraco/cpython that referenced this pull request Aug 26, 2024
jaraco added a commit to python/cpython that referenced this pull request Aug 27, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 27, 2024
…ythonGH-123354)

Applies changes from zipp 3.20.1 and jaraco/zippGH-124
(cherry picked from commit 2231286)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 27, 2024
…ythonGH-123354)

Applies changes from zipp 3.20.1 and jaraco/zippGH-124
(cherry picked from commit 2231286)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
jaraco added a commit to jaraco/cpython that referenced this pull request Aug 28, 2024
…fix. (pythonGH-123354)

Applies changes from zipp 3.20.1 and jaraco/zippGH-124
(cherry picked from commit 2231286)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
jaraco added a commit to jaraco/cpython that referenced this pull request Aug 28, 2024
…rgical fix. (pythonGH-123354)

Applies changes from zipp 3.20.1 and jaraco/zippGH-124
(cherry picked from commit 2231286)
(cherry picked from commit 17b77bb)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
jaraco added a commit to jaraco/cpython that referenced this pull request Aug 28, 2024
…gical fix. (pythonGH-123354)

Applies changes from zipp 3.20.1 and jaraco/zippGH-124
(cherry picked from commit 2231286)
(cherry picked from commit 17b77bb)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
jaraco added a commit to jaraco/cpython that referenced this pull request Aug 28, 2024
…re surgical fix. (pythonGH-123354)

Applies changes from zipp 3.20.1 and jaraco/zippGH-124
(cherry picked from commit 2231286)
(cherry picked from commit 17b77bb)
(cherry picked from commit 66d3383)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Yhg1s pushed a commit to python/cpython that referenced this pull request Sep 2, 2024
…H-123354) (#123410)

gh-123270: Replaced SanitizedNames with a more surgical fix. (GH-123354)

Applies changes from zipp 3.20.1 and jaraco/zippGH-124
(cherry picked from commit 2231286)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
jaraco added a commit to python/cpython that referenced this pull request Sep 2, 2024
…H-123354) (#123411)

gh-123270: Replaced SanitizedNames with a more surgical fix. (GH-123354)

Applies changes from zipp 3.20.1 and jaraco/zippGH-124
(cherry picked from commit 2231286)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
github-actions Bot pushed a commit to m-aciek/python-docs-weblate that referenced this pull request Sep 2, 2024
…GH-123354) (#123411)

gh-123270: Replaced SanitizedNames with a more surgical fix. (GH-123354)

Applies changes from zipp 3.20.1 and jaraco/zippGH-124
(cherry picked from commit 2231286d78d328c2f575e0b05b16fe447d1656d6)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>

CPython-sync-commit-latest: 95b073bddefa6243effa08e131e297c0383e7f6a
ambv pushed a commit to python/cpython that referenced this pull request Sep 4, 2024
…H-123354) (#123433)

Applies changes from zipp 3.20.1 and jaraco/zippGH-124
(cherry picked from commit 2231286)
(cherry picked from commit 17b77bb)
(cherry picked from commit 66d3383)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
ambv pushed a commit to python/cpython that referenced this pull request Sep 4, 2024
…H-123354) (#123432)

Applies changes from zipp 3.20.1 and jaraco/zippGH-124
(cherry picked from commit 2231286)
(cherry picked from commit 17b77bb)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
ambv pushed a commit to python/cpython that referenced this pull request Sep 4, 2024
…H-123354) (#123425)

Applies changes from zipp 3.20.1 and jaraco/zippGH-124
(cherry picked from commit 2231286)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>

* Restore the slash-prefixed paths in the malformed_paths test.
ambv pushed a commit to python/cpython that referenced this pull request Sep 4, 2024
…H-123354) (#123426)

Applies changes from zipp 3.20.1 and jaraco/zippGH-124
(cherry picked from commit 2231286)
(cherry picked from commit 17b77bb)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
ambv pushed a commit to python/cpython that referenced this pull request Sep 5, 2024
…file.Path.name. (#123694)

Applies changes from zipp 3.20.1 and jaraco/zippGH-124
(cherry picked from commit 2231286)
(cherry picked from commit 17b77bb)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants