Skip to content

Commit 242011c

Browse files
committed
Fix issue with binary files
1 parent f3f7e12 commit 242011c

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ name = "lazycodr"
1616
packages = [{include = "lazycodr", from = "src"}]
1717
readme = "README.md"
1818
repository = "https://github.com/bitswired/lazycodr"
19-
version = "0.2.0"
19+
version = "0.2.1"
2020

2121
[tool.poetry.dependencies]
2222
httpx = "^0.24.0"

src/lazycodr/utils/readme.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,14 @@ def tracked_files_generator(path: Path, user_ignore_patterns: list[str]):
3333

3434
spec = pathspec.PathSpec.from_lines("gitwildmatch", ignore_patterns)
3535

36-
for f in files:
37-
if not spec.match_file(f) and f.is_file():
38-
yield path / f
36+
for file_path in files:
37+
if not spec.match_file(file_path) and file_path.is_file():
38+
try:
39+
with file_path.open("r", encoding='utf"8') as f:
40+
f.read()
41+
yield path / file_path
42+
except UnicodeDecodeError:
43+
continue
3944

4045

4146
def batch_iterator(generator, batch_size):

0 commit comments

Comments
 (0)