fix: Propagate command substitution failures (#2039)

This commit is contained in:
Kroese
2026-08-04 11:45:31 +02:00
committed by GitHub
parent 9d01d237c2
commit 0c2dbdf98a
4 changed files with 76 additions and 50 deletions
+8 -4
View File
@@ -1022,15 +1022,19 @@ downloadFile() {
local web_desc="$5"
local connections="${6:-1}"
local domain dots
local domain parent
local msg="Downloading $web_desc"
local console_msg="Downloading $desc"
# Keep mirror messages concise by reducing subdomains to the final two
# labels, while Microsoft downloads retain the generic description.
domain=$(echo "$url" | awk -F/ '{print $3}')
dots=$(echo "$domain" | tr -cd '.' | wc -c)
(( dots > 1 )) && domain=$(expr "$domain" : '.*\.\(.*\..*\)')
domain="${url#*://}"
domain="${domain%%/*}"
if [[ "$domain" == *.*.* ]]; then
parent="${domain#*.}"
[ -n "$parent" ] && domain="$parent"
fi
if [ -n "$domain" ] && [[ "${domain,,}" != *"microsoft.com" ]]; then
console_msg="Downloading $desc from $domain"