diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2016-11-18 12:32:54 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2016-11-18 12:32:54 +0100 |
commit | 472e8e2d16d706e746f718f7d4b3bf86af5af1f1 (patch) | |
tree | 5dccad8fded902b52ea2d5109a370b58ac7a3ed8 | |
parent | 9e5faa5c255fb066a51aef4673971845693ab98e (diff) | |
download | impressive-display-472e8e2d16d706e746f718f7d4b3bf86af5af1f1.tar.gz impressive-display-472e8e2d16d706e746f718f7d4b3bf86af5af1f1.tar.bz2 impressive-display-472e8e2d16d706e746f718f7d4b3bf86af5af1f1.zip |
Fix gunzip code, for PDF URIs that let us retrieve a compressed PDF.
-rwxr-xr-x | bin/impressive-display | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/bin/impressive-display b/bin/impressive-display index c41ba3d..803701d 100755 --- a/bin/impressive-display +++ b/bin/impressive-display @@ -345,12 +345,18 @@ function download_pdffile { if [ -n "$PDF_URL_CREDS" ]; then creds="-u $PDF_URL_CREDS" fi - curl $creds "$PDF_URI" 1> "$pdffile_downloaded" 2>/dev/null + + DOWNLOADED_FILE="$workdir/$(basename $PDF_URI)" + if ! curl $creds "$PDF_URI" 1> "$DOWNLOADED_FILE"; then + $OUTPUT "The curl tool failed in retrieving PDF file." + fi # is the PDF file gzipped? - if echo $(basename $pdffile_downloaded) | grep -E ".*\.gz"; then - pdffile_downloaded=${pdffile_downloaded/.gz/} - gunzip $workdir/$(basename $pdffile_downloaded).gz + if echo "$DOWNLOADED_FILE" | grep -E '.*\.gz$'; then + gunzip -f "$DOWNLOADED_FILE" + mv "${DOWNLOADED_FILE/.gz/}" "$pdffile_downloaded" + else + mv "${DOWNLOADED_FILE}" "$pdffile_downloaded" fi if pdfinfo "$pdffile_downloaded" 1>/dev/null 2>/dev/null; then |