Skip to content
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

Fix file header detection in open_decompress #998

Merged
merged 2 commits into from
Jan 22, 2025

Conversation

yunzheng
Copy link
Member

@yunzheng yunzheng commented Jan 21, 2025

Previously file header could be misread if fileobj position was not at start, leading to incorrect file format detection. Now explicitly seek to beginning before reading the magic file header bytes.

Also fixed the example in the docstring of open_decompress so that it renders it as a code block.

fixes #999

Previously file header could be misread if fileobj position was not at
start, leading to incorrect file format detection. Now explicitly seek
to beginning before reading the magic file header bytes.
Copy link

codecov bot commented Jan 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.76%. Comparing base (cb7b9ec) to head (efb3945).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #998   +/-   ##
=======================================
  Coverage   77.76%   77.76%           
=======================================
  Files         327      327           
  Lines       28653    28654    +1     
=======================================
+ Hits        22281    22282    +1     
  Misses       6372     6372           
Flag Coverage Δ
unittests 77.76% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yunzheng yunzheng requested a review from Schamper January 21, 2025 17:57
@Schamper Schamper merged commit e7d007a into main Jan 22, 2025
18 of 20 checks passed
@Schamper Schamper deleted the bugfix/fsutil-open_decompress-fileobj branch January 22, 2025 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using open_decompress with fileobj can lead to incorrect file format detection
2 participants