mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-12 01:26:47 +01:00
filename handling for archive files.
This commit is contained in:
parent
aaa6599283
commit
8a5c782425
7 changed files with 111 additions and 35 deletions
|
|
@ -11,10 +11,13 @@ def create_source_path_directory(source_path):
|
|||
|
||||
|
||||
# TODO: also make this work for archive dir
|
||||
def delete_empty_directories(directory):
|
||||
def delete_empty_directories(directory, root):
|
||||
if not os.path.isdir(directory):
|
||||
return
|
||||
|
||||
# Go up in the directory hierarchy and try to delete all directories
|
||||
directory = os.path.normpath(directory)
|
||||
root = os.path.normpath(settings.ORIGINALS_DIR)
|
||||
root = os.path.normpath(root)
|
||||
|
||||
if not directory.startswith(root + os.path.sep):
|
||||
# don't do anything outside our originals folder.
|
||||
|
|
@ -102,3 +105,8 @@ def generate_filename(doc):
|
|||
filename += ".gpg"
|
||||
|
||||
return filename
|
||||
|
||||
|
||||
def archive_name_from_filename(filename):
|
||||
|
||||
return os.path.splitext(filename)[0] + ".pdf"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue