From 29d0e36a0c04a56d909df702b124644a55c47f06 Mon Sep 17 00:00:00 2001 From: Dominik George Date: Tue, 9 Aug 2022 23:13:12 +0200 Subject: Actually make curl fail on server errors This is important in scenarios where AleKSIS, due to a race condition, references something like a stale S3 content object. impressive-display should log this and, most importantly, not try to handle the rror output as display file. --- bin/impressive-display | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/impressive-display b/bin/impressive-display index e8ce5a9..b07b06b 100755 --- a/bin/impressive-display +++ b/bin/impressive-display @@ -354,11 +354,15 @@ function download_pdffile { NETRCFILE=" --netrc-file $workdir/secrets/${THIS_HOSTNAME}.secret" fi if [ "x$LOG_TO_SYSLOG" = "xyes" ]; then - if ! curl $NETRCFILE "$pdf_uri_orig" 1> "$DOWNLOADED_FILE" 2>/dev/null; then + if ! curl -f $NETRCFILE "$pdf_uri_orig" 1> "$DOWNLOADED_FILE" 2>/dev/null; then $OUTPUT "The curl tool failed in retrieving PDF file. Run this tool interactively to debug problems." + return fi else - curl $NETRCFILE "$pdf_uri_orig" 1> "$DOWNLOADED_FILE" + if ! curl -f $NETRCFILE "$pdf_uri_orig" 1> "$DOWNLOADED_FILE"; then + $OUTPUT "The curl tool failed in retrieving PDF file." + return + fi fi # is the file gzipped? -- cgit v1.2.3