|
625 | 625 | rm -f "$3"/"$2" |
626 | 626 | if [ -n "$download_script_function_in_use" ] |
627 | 627 | then |
628 | | - if ! curl -sfL "$1"/"$2" -o "$3"/"$2" |
| 628 | + if ! curl -sfL --max-time 10 --connect-timeout 5 "$1"/"$2" -o "$3"/"$2" |
629 | 629 | then |
630 | 630 | # Try Statically.io CDN if this is a GitHub URL |
631 | 631 | if [[ "$1" == *"raw.githubusercontent.com"* ]] |
632 | 632 | then |
633 | 633 | local cdn_url="${1/raw.githubusercontent.com/cdn.statically.io\/gh}" |
634 | | - cdn_url="${cdn_url//\/nextcloud\/vm\//\/nextcloud\/vm\/main\/}" |
635 | | - if curl -sfL "$cdn_url"/"$2" -o "$3"/"$2" |
| 634 | + if curl -sfL --max-time 10 --connect-timeout 5 "$cdn_url"/"$2" -o "$3"/"$2" |
636 | 635 | then |
| 636 | + print_text_in_color "$IGreen" "✓ Used Statically.io CDN" |
637 | 637 | return 0 |
638 | 638 | fi |
639 | 639 | fi |
|
650 | 650 | if [[ "$1" == *"raw.githubusercontent.com"* ]] |
651 | 651 | then |
652 | 652 | local cdn_url="${1/raw.githubusercontent.com/cdn.statically.io\/gh}" |
653 | | - cdn_url="${cdn_url//\/nextcloud\/vm\//\/nextcloud\/vm\/main\/}" |
654 | | - if curl -sfL "$cdn_url"/"$2" -o "$3"/"$2" |
| 653 | + if curl -sfL --max-time 10 --connect-timeout 5 "$cdn_url"/"$2" -o "$3"/"$2" |
655 | 654 | then |
656 | 655 | print_text_in_color "$IGreen" "✓ Used Statically.io CDN" |
657 | 656 | break |
|
671 | 670 | fi |
672 | 671 | fi |
673 | 672 | fi |
674 | | - if ! curl -sfL "$1"/"$2" -o "$3"/"$2" |
| 673 | + if ! curl -sfL --max-time 10 --connect-timeout 5 "$1"/"$2" -o "$3"/"$2" |
675 | 674 | then |
676 | 675 | msg_box "We just tried to fetch '$1/$2', but it seems like the server for the download isn't reachable, or that a temporary error occurred. We will now try again. |
677 | 676 | Please report this issue to $ISSUES" |
@@ -2357,8 +2356,9 @@ try_local_backup() { |
2357 | 2356 |
|
2358 | 2357 | # Convert URL to local path |
2359 | 2358 | # https://raw.githubusercontent.com/nextcloud/vm/main/apps/script.sh -> apps/script.sh |
| 2359 | + # https://raw.githubusercontent.com/nextcloud/vm/main -> (empty, root level) |
2360 | 2360 | local path_part |
2361 | | - path_part=$(echo "$url" | sed 's|https://raw.githubusercontent.com/nextcloud/vm/main/||' | sed 's|https://raw.githubusercontent.com/nextcloud/vm/master/||') |
| 2361 | + path_part=$(echo "$url" | sed 's|https://raw.githubusercontent.com/nextcloud/vm/main||' | sed 's|https://raw.githubusercontent.com/nextcloud/vm/master||' | sed 's|^/||') |
2362 | 2362 |
|
2363 | 2363 | # If path_part is empty, we're downloading from root |
2364 | 2364 | if [ -z "$path_part" ] |
|
0 commit comments