File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
scripts/post-consumption/content-matching Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -12,10 +12,18 @@ SCRIPT_DIR=$(dirname "$SCRIPT_PATH")
12
12
# Make sure organize-tool and poppler-utils has been installed
13
13
# on your system (resp. container, via custom-cont-init.d)
14
14
15
+ # In certain cases, like encrypted PDFs, no archived version is created by paperless.
16
+ # In this case, the archive path is "None". However, organize can still use the file.
17
+ # Therefore, use the source path instead.
18
+ if [[ " ${DOCUMENT_ARCHIVE_PATH} " != " None" ]] ; then
19
+ DOCUMENT=" ${DOCUMENT_ARCHIVE_PATH} "
20
+ else
21
+ DOCUMENT=" ${DOCUMENT_SOURCE_PATH} "
22
+ fi
15
23
# organize-tool doesn't accept full file path as argument
16
24
# but expects directory and filename pattern without extension instead
17
- export DOCUMENT_ARCHIVE_FILENAME=$( basename " ${DOCUMENT_ARCHIVE_PATH } " )
18
- export DOCUMENT_ARCHIVE_DIR=$( dirname " ${DOCUMENT_ARCHIVE_PATH } " )
25
+ export DOCUMENT_ARCHIVE_FILENAME=$( basename " ${DOCUMENT } " )
26
+ export DOCUMENT_ARCHIVE_DIR=$( dirname " ${DOCUMENT } " )
19
27
20
28
# While organize supports environment variables as placeholders in it's configuration,
21
29
# it's not yet supported everywhere in the configuration (e.g. filters),
You can’t perform that action at this time.
0 commit comments