fix pdf password script
This commit is contained in:
parent
a478052194
commit
2aa5edf2ac
1 changed files with 8 additions and 0 deletions
8
paperless/scripts/removePdfPassword.py
Normal file → Executable file
8
paperless/scripts/removePdfPassword.py
Normal file → Executable file
|
@ -25,6 +25,7 @@ def read_passwords_from_file():
|
|||
if not passwords:
|
||||
print("Empty password file")
|
||||
|
||||
passwords.append("") # some PDFs are encrypted with empty password
|
||||
return passwords
|
||||
|
||||
|
||||
|
@ -58,6 +59,13 @@ if __name__ == "__main__":
|
|||
|
||||
doc_path = os.environ.get('DOCUMENT_WORKING_PATH')
|
||||
|
||||
if not doc_path:
|
||||
doc_path = sys.argv[1]
|
||||
|
||||
if not doc_path:
|
||||
print("Neither DOCUMENT_WORKING_PATH set nor document passed by parameter.")
|
||||
sys.exit(1)
|
||||
|
||||
if not os.path.exists(doc_path):
|
||||
print(f"Document {doc_path} not found.")
|
||||
sys.exit(1)
|
||||
|
|
Loading…
Reference in a new issue