Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion detect_secrets/core/secrets_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,17 @@ def _extract_secrets_from_file(
f.seek(0)

except UnicodeDecodeError:
file_is_binary = is_binary(filename)
log.warning('UnicodeDecodeError encountered while scanning file: %s', filename)
try:
file_is_binary = is_binary(filename)
except Exception as e:
# Handle cases where is_binary() itself fails (e.g., chardet compatibility issues)
log.error(
'Could not determine if file is binary (%s): %s',
filename,
str(e),
)
raise

if not file_is_binary and not suppress_unscannable_file_warnings:
log.warning(
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
'packaging',
'tabulate',
'binaryornot',
'chardet>=3.0.2,<7.0.0',
],
extras_require={
'word_list': [
Expand Down