Issue 47200: Add ZipInfo.mode property

Issue47200

Created on 2022-04-02 12:21 by sam_ezeh, last changed 2022-04-11 14:59 by admin.

Files
File name Uploaded Description Edit
sam_ezeh.patch sam_ezeh, 2022-04-02 12:21
Pull Requests
URL Status Linked Edit
PR 32252 open sam_ezeh, 2022-04-02 13:50
Messages (1)
msg416550 - (view) Author: Sam Ezeh (sam_ezeh) * Date: 2022-04-02 12:21
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.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.
History
Date User Action Args
2022-04-11 14:59:58adminsetgithub: 91356
2022-04-02 21:29:27ethan.furmansetnosy: + alanmcintyre, serhiy.storchaka
2022-04-02 21:28:33ethan.furmansetnosy: + twouters, ethan.furman
2022-04-02 13:50:57sam_ezehsetstage: patch review
pull_requests: + pull_request30323
2022-04-02 12:21:15sam_ezehcreate