diff --git a/.github/actions/spell-check/expect.txt b/.github/actions/spell-check/expect.txt index ae62af06c2..eda910ed43 100644 --- a/.github/actions/spell-check/expect.txt +++ b/.github/actions/spell-check/expect.txt @@ -669,6 +669,7 @@ FRAMEDOWNLOAD franky Froml fstream +ftp ftps FTYPE FULLNAME diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Uri.UnitTests/UriHelper/ExtendedUriParserTests.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Uri.UnitTests/UriHelper/ExtendedUriParserTests.cs index 7d67a9572b..4409bfd528 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Uri.UnitTests/UriHelper/ExtendedUriParserTests.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Uri.UnitTests/UriHelper/ExtendedUriParserTests.cs @@ -52,6 +52,10 @@ namespace Microsoft.Plugin.Uri.UnitTests.UriHelper [DataRow("http://[2001:0DB8::1]", true, "http://[2001:db8::1]/")] [DataRow("[2001:0DB8::1]:80", true, "https://[2001:db8::1]/")] [DataRow("http://[2001:0DB8::1]:80", true, "http://[2001:db8::1]/")] + [DataRow("mailto:example@mail.com", true, "mailto:example@mail.com")] + [DataRow("tel:411", true, "tel:411")] + [DataRow("ftp://example.com", true, "ftp://example.com/")] + public void TryParseCanParseHostName(string query, bool expectedSuccess, string expectedResult) { // Arrange diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Uri/UriHelper/ExtendedUriParser.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Uri/UriHelper/ExtendedUriParser.cs index ea56595d0d..322b2a5efa 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Uri/UriHelper/ExtendedUriParser.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Uri/UriHelper/ExtendedUriParser.cs @@ -35,8 +35,17 @@ namespace Microsoft.Plugin.Uri.UriHelper var hadDefaultPort = urlBuilder.Uri.IsDefaultPort; urlBuilder.Port = hadDefaultPort ? -1 : urlBuilder.Port; - if (!input.Contains("HTTP://", StringComparison.OrdinalIgnoreCase) && - !input.Contains("FTPS://", StringComparison.OrdinalIgnoreCase)) + if (input.Contains("HTTP://", StringComparison.OrdinalIgnoreCase)) + { + urlBuilder.Scheme = System.Uri.UriSchemeHttp; + } + else if (input.Contains(":", StringComparison.OrdinalIgnoreCase) && + !input.Contains("http", StringComparison.OrdinalIgnoreCase) && + !input.Contains("[", StringComparison.OrdinalIgnoreCase)) + { + // Do nothing, leave unchanged + } + else { urlBuilder.Scheme = System.Uri.UriSchemeHttps; } diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Main.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Main.cs index c091c75272..adc3e4b2e9 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Main.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Main.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation +// Copyright (c) Microsoft Corporation // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information.