[New-bugs-announce] [issue45286] zipfile missing API for links
mxmlnkn
report at bugs.python.org
Sat Sep 25 08:27:00 EDT 2021
New submission from mxmlnkn <maxinator333 at googlemail.com>:
When using zipfile as a library to get simple files, there is no way to method to determine whether a ZipInfo object is a link or not. Moreover, links can be simply opened and read like normal files and will contain the link path, which is unexpected in most cases, I think.
ZipInfo already has an `is_dir` getter. It would be nice if there also was an `is_link` getter. Note that `__repr__` actually shows the filemode, which is `lrwxrwxrwx`. But there is not even a getter for the file mode.
For now, I can try to use the code from `__repl__` to extract the file mode from the `external_attr` member but the contents of that member are not documented in zipfile and assuming it is the same as in the ZIP file format specification, it's OS-dependent.
Additionally to `is_link` some getter like `linkname` or so would be nice. As to how it should behave when calling `open` or `read` on a link, I'm not sure.
----------
messages: 402617
nosy: mxmlnkn
priority: normal
severity: normal
status: open
title: zipfile missing API for links
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45286>
_______________________________________
More information about the New-bugs-announce
mailing list