Skip to content

Commit

Permalink
Merge pull request #10 from cegea/pdf_upper_case_extension
Browse files Browse the repository at this point in the history
Add support for upper case extension file PDFs
  • Loading branch information
bastienlc authored Sep 21, 2024
2 parents 883bcbf + 38dc0ca commit 6ec82ad
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/pdf_watermark/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ def __init__(
if not os.path.exists(input):
raise ValueError("Input file or directory does not exist.")
elif os.path.isdir(input):
if output is not None and output.endswith(".pdf"):
if output is not None and output.endswith((".pdf", ".PDF")):
raise ValueError(
"Output must be a directory when input is a directory."
)
elif os.path.isfile(input) and input.endswith(".pdf"):
if output is not None and not output.endswith(".pdf"):
elif os.path.isfile(input) and input.endswith((".pdf", ".PDF")):
if output is not None and not output.endswith((".pdf", ".PDF")):
raise ValueError("Output must be a pdf file when input is a pdf file.")
else:
raise ValueError("Input must be a pdf file or a directory.")
Expand Down Expand Up @@ -92,7 +92,7 @@ def add_directory_to_files(
if os.path.isdir(input_path):
self.add_directory_to_files(input_path, output_path)

elif os.path.isfile(input_path) and input_path.endswith(".pdf"):
elif os.path.isfile(input_path) and input_path.endswith((".pdf", ".PDF")):
self.input_files.append(input_path)
self.output_files.append(output_path)

Expand Down

0 comments on commit 6ec82ad

Please sign in to comment.