Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc0fa220

Browse files
committed
Convert os.altsep to '/' in filenames when creating ZipInfo objects
This causes the zipfile module to also consider the character defined by`os.altsep` (if there is one) to be a path separator and convert it to aforward slash, as defined by the zip specification.
1 parent3d29eda commitc0fa220

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

‎Lib/zipfile/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,8 @@ def _sanitize_filename(filename):
352352
# ZIP format specification.
353353
ifos.sep!="/"andos.sepinfilename:
354354
filename=filename.replace(os.sep,"/")
355+
ifos.altsepandos.altsep!="/"andos.altsepinfilename:
356+
filename=filename.replace(os.altsep,"/")
355357
returnfilename
356358

357359

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
When creating zip files using the ``zipfile`` module, ``os.altsep`` will always
2+
be treated as a path separator. Patch by Carey Metcalfe.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp