mirror of
https://github.com/community-scripts/ProxmoxVED.git
synced 2026-02-24 21:47:26 +00:00
Fix download_with_progress() content_length calc
This commit is contained in:
committed by
Michel Roegl-Brunner
parent
54bbdc180a
commit
622fda4b32
@@ -1692,7 +1692,13 @@ function download_with_progress() {
|
||||
|
||||
# Content-Length aus HTTP-Header holen
|
||||
local content_length
|
||||
content_length=$(curl -fsSLI "$url" | awk '/Content-Length/ {print $2}' | tr -d '\r' || true)
|
||||
content_length=$(
|
||||
curl -fsSLI "$url" 2>/dev/null |
|
||||
# May return multiple values on redirect. i.e., 0 and content_length
|
||||
# Add 0 to $2 to cast it to int
|
||||
awk '(tolower($1) ~ /^content-length:/) && ($2 + 0 > 0) {print $2+0}' |
|
||||
tr -cd '[:digit:]' || true
|
||||
)
|
||||
|
||||
if [[ -z "$content_length" ]]; then
|
||||
if ! curl -fL# -o "$output" "$url"; then
|
||||
@@ -6205,4 +6211,3 @@ function fetch_and_deploy_archive() {
|
||||
msg_ok "Successfully deployed archive to $directory"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user