summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/impressive-display14
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