From 4efd5f7d93df340f08ec8fdc5b3e20fcc9011409 Mon Sep 17 00:00:00 2001 From: Martin Wimpress Date: Tue, 23 Apr 2024 06:31:02 +0100 Subject: [PATCH] refactor: make --header support in web_get() the same as web_check() --- quickget | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/quickget b/quickget index de6fa34..fa02202 100755 --- a/quickget +++ b/quickget @@ -1221,6 +1221,7 @@ function web_pipe() { # Download a file from the web function web_get() { + local HEADERS=() local URL="${1}" local DIR="${2}" local FILE="" @@ -1235,14 +1236,16 @@ function web_get() { # Process any URL redirections after the file name has been extracted URL=$(web_redirect "${URL}") + # Process any headers while (( "$#" )); do - if [[ $1 == --header ]]; then - HEADERS+=("$1" "$2") + if [ "${1}" == "--header" ]; then + HEADERS+=("${1}" "${2}") shift 2 else shift fi done + # Test mode for ISO if [ "${just}" == 'show' ]; then echo "${URL}"