mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-15 19:27:56 +01:00
[PTRun][Uri] Enable analyzer and fix warnings (#16940)
This commit is contained in:
committed by
GitHub
parent
462b48edae
commit
3b04cfd267
@@ -13,6 +13,8 @@
|
||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||
<Platforms>x64</Platforms>
|
||||
<NeutralLanguage>en-US</NeutralLanguage>
|
||||
<EnableNETAnalyzers>true</EnableNETAnalyzers>
|
||||
<AnalysisMode>Recommended</AnalysisMode>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Microsoft.Plugin.Uri.UriHelper
|
||||
const string schemeRegex = @"^([a-z][a-z0-9+\-.]*):";
|
||||
if (input.EndsWith(":", StringComparison.OrdinalIgnoreCase)
|
||||
&& !input.StartsWith("http", StringComparison.OrdinalIgnoreCase)
|
||||
&& !input.Contains("/", StringComparison.OrdinalIgnoreCase)
|
||||
&& !input.Contains('/', StringComparison.OrdinalIgnoreCase)
|
||||
&& !input.All(char.IsDigit)
|
||||
&& Regex.IsMatch(input, schemeRegex))
|
||||
{
|
||||
@@ -60,9 +60,9 @@ namespace Microsoft.Plugin.Uri.UriHelper
|
||||
urlBuilder.Scheme = System.Uri.UriSchemeHttp;
|
||||
isWebUri = true;
|
||||
}
|
||||
else if (input.Contains(":", StringComparison.OrdinalIgnoreCase) &&
|
||||
else if (input.Contains(':', StringComparison.OrdinalIgnoreCase) &&
|
||||
!input.StartsWith("http", StringComparison.OrdinalIgnoreCase) &&
|
||||
!input.Contains("[", StringComparison.OrdinalIgnoreCase))
|
||||
!input.Contains('[', StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// Do nothing, leave unchanged
|
||||
isWebUri = false;
|
||||
|
||||
Reference in New Issue
Block a user