This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author obfusk
Recipients christian.heimes, eighthave, jondo, obfusk
Date 2021-03-22.22:58:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1616453883.44.0.37209372146.issue43547@roundup.psfhosted.org>
In-reply-to
Content
I've closed the PR for now.

Using a carefully crafted ZipInfo object doesn't work because ZipFile modifies its .external_attr when set to 0.

Using something like this quickly hacked together ZipInfo subclass does work:

class ZeroedZipInfo(zipfile.ZipInfo):
    def __init__(self, zinfo):
        for k in self.__slots__:
            setattr(self, k, getattr(zinfo, k))

    def __getattribute__(self, name):
        if name == "date_time":
            return (1980,0,0,0,0,0)
        if name == "external_attr":
            return 0
        return object.__getattribute__(self, name)

...

myzipfile.writestr(ZeroedZipInfo(info), data)
History
Date User Action Args
2021-03-22 22:58:03obfusksetrecipients: + obfusk, christian.heimes, jondo, eighthave
2021-03-22 22:58:03obfusksetmessageid: <1616453883.44.0.37209372146.issue43547@roundup.psfhosted.org>
2021-03-22 22:58:03obfusklinkissue43547 messages
2021-03-22 22:58:03obfuskcreate