Bug report
Excess spaces at the end of files or repositorys are not handle when extracting zip files on Windows.
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Documents \\test.txt'
Can be tested with this Documents.zip
and this piece of code:
from zipfile import ZipFile
with ZipFile('Documents.zip', 'r') as zip:
zip.extractall()
Fix proposal
cpython/Lib/zipfile.py : 1690
# remove end spaces
def remove_end_spaces(x):
for c in x[::-1]:
if(c == ' '): x = x[:-1]
else: return x
arcname = (remove_end_spaces(x) for x in arcname)
Your environment
- CPython versions tested on: python 3.9
- Operating system and architecture: Windows 10 Professionnel 21H2 19044.1706
Linked PRs
Reactions are currently unavailable
Bug report
Excess spaces at the end of files or repositorys are not handle when extracting zip files on Windows.
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Documents \\test.txt'
Can be tested with this Documents.zip
and this piece of code:
from zipfile import ZipFile with ZipFile('Documents.zip', 'r') as zip: zip.extractall()Fix proposal
cpython/Lib/zipfile.py : 1690
# remove end spaces def remove_end_spaces(x): for c in x[::-1]: if(c == ' '): x = x[:-1] else: return x arcname = (remove_end_spaces(x) for x in arcname)Your environment
Linked PRs