Skip to content
Open
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
12 changes: 10 additions & 2 deletions src/dotnet-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,16 @@ get_normalized_channel() {
return 0
;;
*)
echo "$channel"
return 0
if [[ "$channel" =~ ^[0-9]+\.[0-9]+$ ]]; then
echo "$channel"
return 0
elif [[ "$channel" =~ ^[0-9]+\.[0-9]+\.[0-9]+[a-z]{2}$ ]]; then
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs to be a bit more flexible and consider daily and preview packages. They'll have channel names like:

11.0.1xx-preview2:

.\.dotnet\dotnet-install.ps1 -channel 11.0.1xx-preview2 -verbose -Quality daily

echo "$channel"
return 0
else
say_err "'$1' is not a supported value for --channel option. Supported values are: STS, LTS, a 2-part version in A.B format (e.g., 10.0), or a 3-part SDK band version in A.B.Cxx format (e.g., 5.0.1xx). If you think this is a bug, report it at https://github.com/dotnet/install-scripts/issues."
return 1
fi
;;
esac
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ public void CanResolveCorrectLocationBasedOnVersion(string version, string locat
[InlineData("release/2.6.1xx")]
[InlineData("4.8.2")]
[InlineData("abcdefg")]
[InlineData("10")]
public void WhenInvalidChannelWasUsed(string channel)
{
string feedCredentials = Guid.NewGuid().ToString();
Expand All @@ -314,7 +315,7 @@ public void WhenInvalidChannelWasUsed(string channel)

// Standard 'dryrun' criterion
commandResult.Should().Fail();
commandResult.Should().HaveStdErrContaining("Failed to resolve the exact version number.");
commandResult.Should().HaveStdErrContaining("is not a supported value for --channel option.");
commandResult.Should().NotHaveStdOutContaining("Repeatable invocation:");
commandResult.Should().NotHaveStdOutContainingIgnoreCase(feedCredentials);
commandResult.Should().NotHaveStdErrContainingIgnoreCase(feedCredentials);
Expand Down
Loading