diff --git a/src/filters/rclpdf.py b/src/filters/rclpdf.py index 0ac7f051..e9a99a6a 100755 --- a/src/filters/rclpdf.py +++ b/src/filters/rclpdf.py @@ -193,7 +193,6 @@ class PDFExtractor: if not tmpdir or not self.pdftk: # no big deal return True - try: vacuumdir(tmpdir) subprocess.check_call([self.pdftk, self.filename, "unpack_files", @@ -433,6 +432,21 @@ class PDFExtractor: return False else: tmpdir = tempfile.mkdtemp(prefix='rclmpdf') + if self.pdftk and re.match("/snap/", self.pdftk): + # We know this is Unix (Ubuntu actually). Check that tmpdir + # belongs to the user as snap commands can't use /tmp to share + # files. Don't generate an error as this only affects + # attachment extraction + ok = False + if "TMPDIR" in os.environ: + st = os.stat(os.environ["TMPDIR"]) + if st.st_uid == os.getuid(): + ok = True + if not ok: + self.em.rclog( + "pdftk is a snap command and needs TMPDIR to be " + "a directory you own") + ###### File type handler api, used by rclexecm ----------> def openfile(self, params): diff --git a/tests/pdfattach/pdfattach.sh b/tests/pdfattach/pdfattach.sh new file mode 100755 index 00000000..bc4cf1f5 --- /dev/null +++ b/tests/pdfattach/pdfattach.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +topdir=`dirname $0`/.. +. $topdir/shared.sh + +initvariables $0 + +( + recollq -S url '"Rosetten von Spitzwegerich"' +) 2> $mystderr | egrep -v '^Recoll query: ' > $mystdout + +diff -w ${myname}.txt $mystdout > $mydiffs 2>&1 + +checkresult diff --git a/tests/pdfattach/pdfattach.txt b/tests/pdfattach/pdfattach.txt new file mode 100644 index 00000000..3edf7a9c --- /dev/null +++ b/tests/pdfattach/pdfattach.txt @@ -0,0 +1,2 @@ +1 results +application/pdf [file:///home/dockes/projets/fulltext/testrecoll/pdfattach/Turnierausschreibung.pdf] [Rezept] 57269 bytes