mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 20:27:36 +02:00
HTTPS by default, HTTP only if specified (#12394)
* HTTPS by default, HTTP only if specified * Added/Updated unit tests;Added FTPS
This commit is contained in:
@@ -32,6 +32,14 @@ namespace Microsoft.Plugin.Uri.UriHelper
|
||||
try
|
||||
{
|
||||
var urlBuilder = new UriBuilder(input);
|
||||
var hadDefaultPort = urlBuilder.Uri.IsDefaultPort;
|
||||
urlBuilder.Port = hadDefaultPort ? -1 : urlBuilder.Port;
|
||||
|
||||
if (!input.Contains("HTTP://", StringComparison.OrdinalIgnoreCase) &&
|
||||
!input.Contains("FTPS://", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
urlBuilder.Scheme = System.Uri.UriSchemeHttps;
|
||||
}
|
||||
|
||||
result = urlBuilder.Uri;
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user