Skip to content

Commit a5d8df1

Browse files
Merge pull request #12 from cschneider83/patch-1
Use Source Path instead of Archive Path if Archive Path is "None"
2 parents c40617d + 2dd6496 commit a5d8df1

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

scripts/post-consumption/content-matching/post-consumption-wrapper.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,18 @@ SCRIPT_DIR=$(dirname "$SCRIPT_PATH")
1212
# Make sure organize-tool and poppler-utils has been installed
1313
# on your system (resp. container, via custom-cont-init.d)
1414

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
1523
# organize-tool doesn't accept full file path as argument
1624
# 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}")
1927

2028
# While organize supports environment variables as placeholders in it's configuration,
2129
# it's not yet supported everywhere in the configuration (e.g. filters),

0 commit comments

Comments
 (0)