Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/dotnet-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,12 @@ get_download_link_from_aka_ms() {
http_codes=$( echo "$response" | awk '$1 ~ /^HTTP/ {print $2}' )
# They all need to be 301, otherwise some links are broken (except for the last, which is not a redirect but 200 or 404).
broken_redirects=$( echo "$http_codes" | sed '$d' | grep -v '301' )
# The response may end without final code 2xx/4xx/5xx somehow, e.g. network restrictions on www.bing.com causes redirecting to bing.com fails with connection refused.
# In this case it should not exclude the last.
last_http_code=$( echo "$http_codes" | tail -n 1 )
if ! [[ $last_http_code =~ ^(2|4|5)[0-9][0-9]$ ]]; then
broken_redirects=$( echo "$http_codes" | grep -v '301' )
fi

# All HTTP codes are 301 (Moved Permanently), the redirect link exists.
if [[ -z "$broken_redirects" ]]; then
Expand Down
1 change: 1 addition & 0 deletions tests/Install-Scripts.Test/AkaMsLinksTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class AkaMsLinksTests : TestBase

[InlineData("6.0", "daily", @"https://aka.ms/dotnet/6.0/daily/dotnet-sdk-")]
[InlineData("7.0", "daily", @"https://aka.ms/dotnet/7.0/daily/dotnet-sdk-")]
[InlineData("9.0", "preview", @"https://aka.ms/dotnet/9.0/preview/dotnet-sdk-")]
public void SDK_IntegrationTest(string channel, string quality, string expectedLink)
{
string expectedLinkPattern = Regex.Escape(expectedLink);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public class GivenThatIWantToInstallDotnetFromAScript : IDisposable
("7.0", "7\\.0\\..*", Quality.Ga),
("8.0", "8\\.0\\..*", Quality.None),
("8.0", "8\\.0\\..*", Quality.Ga),
("9.0", "9\\.0\\..*", Quality.None),
("9.0", "9\\.0\\..*", Quality.Preview),
("9.0", "9\\.0\\..*", Quality.Ga),
};

/// <summary>
Expand Down