-
-
Notifications
You must be signed in to change notification settings - Fork 32k
random access uncompressed unencrypted ZipExtFile #128131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
There is a bug in |
Can you revise the original post to clarify what’s going on here? I read it, but I don’t understand: what is wrong with the current behavior? Under what conditions do the problems occur and thus who is affected? What do you expect instead? Just articulate as much as you can so it’s clear from the problem description what the proposed improvement is. |
#27737 does not really support random access, currently zipfile can only read uncompressed unencrypted ZipExtFile sequentially (only forward seek). |
Thanks vvb2060. Let me re-articulate what I think you're saying. In #27737, the zipfile module introduced the possibility of seeking within a zip file, but only for compressed or encrypted payloads. Today, if someone attempts to seek with an offset that's 0 or negative, the wrong logic is reached, and an error occurs. Instead, it should be straightforward to enable seeking in any direction (any value of read_offset) consistently (for unencrypted, uncompressed files). |
…crypted files in ZipFile (#128143) Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Bénédikt Tran <[email protected]>
…d unencrypted files in ZipFile (pythonGH-128143) (cherry picked from commit dda02eb) Co-authored-by: 5ec1cff <[email protected]> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Bénédikt Tran <[email protected]>
…d unencrypted files in ZipFile (pythonGH-128143) (cherry picked from commit dda02eb) Co-authored-by: 5ec1cff <[email protected]> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Bénédikt Tran <[email protected]>
…ed unencrypted files in ZipFile (GH-128143) (#129091) GH-128131: Completely support random read access of uncompressed unencrypted files in ZipFile (GH-128143) (cherry picked from commit dda02eb) Co-authored-by: 5ec1cff <[email protected]> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Bénédikt Tran <[email protected]>
See #128143 (comment) for the rationale of backports and the |
…ed unencrypted files in ZipFile (GH-128143) (#129092) GH-128131: Completely support random read access of uncompressed unencrypted files in ZipFile (GH-128143) (cherry picked from commit dda02eb) Co-authored-by: 5ec1cff <[email protected]> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Bénédikt Tran <[email protected]>
Closing since completed and backported. Thank you everyone. |
…d unencrypted files in ZipFile (python#128143) Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Bénédikt Tran <[email protected]>
Feature or enhancement
Proposal:
cpython/Lib/zipfile/__init__.py
Lines 1164 to 1177 in 78ffba4
if read_offset < 0, ZipExtFile is reset and read from the beginning. I think
read_offset > 0
is unnecessary.Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
The text was updated successfully, but these errors were encountered: