Fix binary issue file handling - #3514
Open
Sanjays2402 wants to merge 2 commits into
Open
Conversation
Skip files that cannot be decoded while building issue hashes so binary artifacts cannot abort publication. Add a regression for the reported WebP failure.
Archaeopteryx
requested changes
Aug 6, 2026
| except (FileNotFoundError, IsADirectoryError): | ||
| logger.warning("Failed to find issue's related file", path=file_path) | ||
| except (FileNotFoundError, IsADirectoryError, UnicodeDecodeError): | ||
| logger.warning("Failed to read issue's related file", path=file_path) |
Collaborator
There was a problem hiding this comment.
Please use a separate except clause for this.
Author
There was a problem hiding this comment.
Split out in c620ae3. UnicodeDecodeError now has its own clause with a message that
says what actually went wrong, so the "failed to find" warning stays about missing paths:
except (FileNotFoundError, IsADirectoryError):
logger.warning("Failed to find issue's related file", path=file_path)
file_content = None
except UnicodeDecodeError:
logger.warning(
"Failed to decode issue's related file, it is not text",
path=file_path,
)
file_content = Nonebot/tests/test_revisions.py is 6 passed with test_binary_file_content_is_ignored
green; test_revision_before_after fails the same way on the unmodified branch
(TypeError: 'NoneType' object does not support item assignment at line 234), so it is
not from this change.
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.
Closes #3365. Binary files referenced by analysis issues could raise
UnicodeDecodeErrorwhile building issue hashes and abort publication. Treat undecodable files like missing files so those issues are skipped, with a regression covering the WebP failure.