refactor: update web_pipe() to use web_redirect()

This commit is contained in:
Martin Wimpress 2024-04-20 11:01:55 +01:00 committed by Martin Wimpress
parent 806b1a439f
commit 592b838db6
1 changed files with 2 additions and 7 deletions

View File

@ -1440,13 +1440,8 @@ function check_hash() {
} }
function web_pipe() { function web_pipe() {
# Check for URL redirections local URL=""
# Output to nonexistent directory so the download fails fast URL=$(web_redirect "${1}")
local URL="${1}"
local REDIRECT_URL=$(curl --silent --location --fail "${URL}" --write-out %{url_effective} --output /var/cache/${RANDOM}/${RANDOM})
if [ "${REDIRECT_URL}" != "${URL}" ]; then
URL="${REDIRECT_URL}"
fi
curl --silent --location "${URL}" curl --silent --location "${URL}"
} }