Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!
Check out: eBank.nz (Art Generator) |
Netwrck.com (AI Tools) |
Text-Generator.io (AI API) |
BitBank.nz (Crypto AI) |
ReadingTime (Kids Reading) |
RewordGame |
BigMultiplayerChess |
WebFiddle |
How.nz |
Helix AI Assistant
Activity
dignissimus commentedon Jun 20, 2022
Removing trailing spaces can be done using
str.rstrip
.I don't think this is an issue with the zipfile library. Testing the file using unzip shows the filename as including trailing spaces and unzip extracts the file with the directory name containing the trailing spaces. I don't think this behaviour needs to be changed and I don't think it should be altered.
Testing with p7zip shows the same
Rygone commentedon Jun 20, 2022
Completely agree with the
str.rstrip
.However, the problem is on Windows machines.
Windows Explorer extracts them without spaces at the end because it is not possible to have files or repositorys that end with spaces on Windows.
That's why I propose to make the change in
_sanitize_windows_name()
.And it's already done for dots :1688
So new proposal
cpython/Lib/zipfile.py : 1687
dignissimus commentedon Jun 20, 2022
Ok, if it causes errors on Windows then updating the sanitisation function for windows sounds very reasonable
pythongh-94018: Remove trailing spaces in _sanitize_windows_name (pyt…
pythongh-94018: Remove trailing spaces in _sanitize_windows_name (pyt…