Repository navigation
Fix empty content inspection falling back to a file path - #383
Open
pacocartones wants to merge 1 commit into
Open
pacocartones wants to merge 1 commit into
pacocartones wants to merge 1 commit into
Conversation
Member
|
What's your intention here? This library hasn't had a release in years and no longer supports xlsx. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
inspect_format(content=b'')receives empty bytes, it treats them as omitted content. With no path this raisesTypeError; with an XLSX path it inspects that file instead and returns'xlsx'. DistinguishNonefrom empty bytes so unknown empty content returnsNoneand supplied content retains priority.This changes one production line and adds two regression tests. Both tests fail on unchanged master (
d8302dc39b16c03d643ef1eee89605c2e007ed2b) and pass with the fix. Validation on Python 3.12.3, Linux/WSL:python -m pytest -q tests/test_inspect.py tests/test_open_workbook.py— 14 passed.git diff --checkpasses. The full suite and platform matrix were not run.Scope: this fixes
inspect_formatonly. It does not fix all handling ofopen_workbook(file_contents=b''), which has separate fallback logic inbook.py. Related historical context: #55 discussed the same distinction in the olderopen_workbookimplementation and was closed without follow-up.