Skip to content

Commit

Permalink
Fix adding of too small and large images
Browse files Browse the repository at this point in the history
  • Loading branch information
kbengs committed Nov 19, 2023
1 parent 82506df commit c7e5473
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pdfarranger/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,13 @@ def _img_to_pdf(filename, tmp_dir):
except AttributeError:
# img2pdf is too old so we can't support invalid EXIF rotation
rot = None
f.write(img2pdf.convert(filename, rotation=rot))
try:
pdf = img2pdf.convert(filename, rotation=rot)
except ValueError as e:

Check warning on line 502 in pdfarranger/core.py

View check run for this annotation

Codecov / codecov/patch

pdfarranger/core.py#L502

Added line #L502 was not covered by tests
# Too small or large image
raise PDFDocError(e)
return None

Check warning

Code scanning / CodeQL

Unreachable code Warning

This statement is unreachable.

Check warning on line 505 in pdfarranger/core.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

pdfarranger/core.py#L505

Unreachable code

Check warning on line 505 in pdfarranger/core.py

View check run for this annotation

Codecov / codecov/patch

pdfarranger/core.py#L504-L505

Added lines #L504 - L505 were not covered by tests
f.write(pdf)
return pdf_file_name


Expand Down

0 comments on commit c7e5473

Please sign in to comment.