You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've attached a patch that gives ZipInfo objects a ZipInfo.mode property getter and setter to get and set the file mode.
I considered adding ZipFile.chmod but I didn't know how it would work given that archives can contain duplicate files.
As an aside, I wondered if there's a way to update file attributes inside zip archives without deleting and rewriting them and if not, whether it would be worthwhile to add one.
While the supplied patch adding a property for mode makes sense, I think it'd need to go a little further and handle things like the 0o40000 bit for Directory and whatever other potential bits zip files are able to represent. not just the base 9-bit posix mode values.
Activity
dignissimus commentedon Apr 2, 2022
Initially, I was looking at bpo-18262 and saw the following Stack Overflow thread that was linked.
https://stackoverflow.com/questions/434641/how-do-i-set-permissions-attributes-on-a-file-in-a-zip-file-using-pythons-zip/6297838
I've attached a patch that gives ZipInfo objects a
ZipInfo.modeproperty getter and setter to get and set the file mode.I considered adding ZipFile.chmod but I didn't know how it would work given that archives can contain duplicate files.
As an aside, I wondered if there's a way to update file attributes inside zip archives without deleting and rewriting them and if not, whether it would be worthwhile to add one.
gpshead commentedon Dec 21, 2023
While the supplied patch adding a property for mode makes sense, I think it'd need to go a little further and handle things like the 0o40000 bit for Directory and whatever other potential bits zip files are able to represent. not just the base 9-bit posix mode values.