Skip to content

Commit d50dc07

Browse files
committed
Consult http_code and download_error_msg only for failed downloads.
1 parent 09142a2 commit d50dc07

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/dotnet-install.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ get_specific_version_from_version() {
489489
local json_file="$5"
490490

491491
if [ -z "$json_file" ]; then
492-
if [[ "$version" == "latest" ]]; then
492+
if [[ "$version" == "latest" ]]; then
493493
local version_info
494494
version_info="$(get_latest_version_info "$azure_feed" "$channel" "$normalized_architecture" false)" || return 1
495495
say_verbose "get_specific_version_from_version: version_info=$version_info"
@@ -522,7 +522,7 @@ construct_download_link() {
522522
local specific_version="${4//[$'\t\r\n']}"
523523
local specific_product_version="$(get_specific_product_version "$1" "$4")"
524524
local osname="$5"
525-
525+
526526
local download_link=null
527527
if [[ "$runtime" == "dotnet" ]]; then
528528
download_link="$azure_feed/Runtime/$specific_version/dotnet-runtime-$specific_product_version-$osname-$normalized_architecture.tar.gz"
@@ -542,7 +542,7 @@ construct_download_link() {
542542
# azure_feed - $1
543543
# specific_version - $2
544544
get_specific_product_version() {
545-
# If we find a 'productVersion.txt' at the root of any folder, we'll use its contents
545+
# If we find a 'productVersion.txt' at the root of any folder, we'll use its contents
546546
# to resolve the version of what's in the folder, superseding the specified version.
547547
eval $invocation
548548

@@ -905,10 +905,10 @@ install_dotnet() {
905905
906906
# The download function will set variables $http_code and $download_error_msg in case of failure.
907907
download "$download_link" "$zip_path" 2>&1 || download_failed=true
908-
primary_path_http_code="$http_code"; primary_path_download_error_msg="$download_error_msg"
909908
910909
# if the download fails, download the legacy_download_link
911910
if [ "$download_failed" = true ]; then
911+
primary_path_http_code="$http_code"; primary_path_download_error_msg="$download_error_msg"
912912
case $primary_path_http_code in
913913
404)
914914
say "The resource at $download_link is not available."
@@ -928,9 +928,9 @@ install_dotnet() {
928928
929929
# The download function will set variables $http_code and $download_error_msg in case of failure.
930930
download "$download_link" "$zip_path" 2>&1 || download_failed=true
931-
legacy_path_http_code="$http_code"; legacy_path_download_error_msg="$download_error_msg"
932931
933932
if [ "$download_failed" = true ]; then
933+
legacy_path_http_code="$http_code"; legacy_path_download_error_msg="$download_error_msg"
934934
case $legacy_path_http_code in
935935
404)
936936
say "The resource at $download_link is not available."
@@ -1132,10 +1132,10 @@ do
11321132
echo " --arch,-Architecture,-Arch"
11331133
echo " Possible values: x64, arm, and arm64"
11341134
echo " --os <system> Specifies operating system to be used when selecting the installer."
1135-
echo " Overrides the OS determination approach used by the script. Supported values: osx, linux, linux-musl, freebsd, rhel.6."
1136-
echo " In case any other value is provided, the platform will be determined by the script based on machine configuration."
1135+
echo " Overrides the OS determination approach used by the script. Supported values: osx, linux, linux-musl, freebsd, rhel.6."
1136+
echo " In case any other value is provided, the platform will be determined by the script based on machine configuration."
11371137
echo " Not supported for legacy links. Use --runtime-id to specify platform for legacy links."
1138-
echo " Refer to: https://aka.ms/dotnet-os-lifecycle for more information."
1138+
echo " Refer to: https://aka.ms/dotnet-os-lifecycle for more information."
11391139
echo " --runtime <RUNTIME> Installs a shared runtime only, without the SDK."
11401140
echo " -Runtime"
11411141
echo " Possible values:"
@@ -1160,7 +1160,7 @@ do
11601160
echo " Installs just the shared runtime bits, not the entire SDK."
11611161
echo " --runtime-id Installs the .NET Tools for the given platform (use linux-x64 for portable linux)."
11621162
echo " -RuntimeId" The parameter is obsolete and may be removed in a future version of this script. Should be used only for versions below 2.1.
1163-
echo " For primary links to override OS or/and architecture, use --os and --architecture option instead."
1163+
echo " For primary links to override OS or/and architecture, use --os and --architecture option instead."
11641164
echo ""
11651165
echo "Install Location:"
11661166
echo " Location is chosen in following order:"
@@ -1197,7 +1197,7 @@ if [ "$dry_run" = true ]; then
11971197
if [ "$valid_legacy_download_link" = true ]; then
11981198
say "Legacy named payload URL: $legacy_download_link"
11991199
fi
1200-
repeatable_command="./$script_name --version "\""$specific_version"\"" --install-dir "\""$install_root"\"" --architecture "\""$normalized_architecture"\"" --os "\""$normalized_os"\"""
1200+
repeatable_command="./$script_name --version "\""$specific_version"\"" --install-dir "\""$install_root"\"" --architecture "\""$normalized_architecture"\"" --os "\""$normalized_os"\"""
12011201
if [[ "$runtime" == "dotnet" ]]; then
12021202
repeatable_command+=" --runtime "\""dotnet"\"""
12031203
elif [[ "$runtime" == "aspnetcore" ]]; then

0 commit comments

Comments
 (0)