From 5334fe011840002bbd5ec86b3e361c73e73a3a50 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 29 Mar 2016 20:17:53 +0200 Subject: Check downloaded PDF for actually being a PDF file. --- debian/changelog | 1 + impressive-display/bin/impressive-display | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/debian/changelog b/debian/changelog index 805239b..50c3021 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,7 @@ impressive-display (0.2.1) UNRELEASED; urgency=medium files, make sure the impressive executable gets killed during clean-up. * Disable debugging option (set -x). * Use $HOME/.impressive-display as temporary data directory. + * Check downloaded PDF for actually being a PDF file. -- Mike Gabriel Tue, 29 Mar 2016 20:14:17 +0200 diff --git a/impressive-display/bin/impressive-display b/impressive-display/bin/impressive-display index b962412..4ba691d 100755 --- a/impressive-display/bin/impressive-display +++ b/impressive-display/bin/impressive-display @@ -250,14 +250,22 @@ function download_pdffile { fi curl $creds "$PDF_URL" 1> "$pdffile_downloaded" 2>/dev/null - merge_portrait_documents + if pdfinfo "$pdffile_downloaded" 1>/dev/null 2>/dev/null; then - cmp -s "$pdffile_downloaded" "$pdffile_previous"> /dev/null - if [ $? -eq 1 ]; then - echo -n "RELOAD" > $impressive_lock - fi + merge_portrait_documents + + cmp -s "$pdffile_downloaded" "$pdffile_previous"> /dev/null + if [ $? -eq 1 ]; then + echo -n "RELOAD" > $impressive_lock + fi + + pdffile=$pdffile_display - pdffile=$pdffile_display + else + + echo "WARNING: PDF file format problems. Maybe not a PDF file?" + + fi } -- cgit v1.2.3