Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.2k
Closed
Description
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 thisDocuments.zip
and this piece of code:
from zipfile import ZipFilewith ZipFile('Documents.zip', 'r') as zip: zip.extractall()
Fix proposal
cpython/Lib/zipfile.py : 1690
# remove end spacesdef remove_end_spaces(x): for c in x[::-1]: if(c == ' '): x = x[:-1] else: return xarcname = (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