mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +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>
|
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||||
<Platforms>x64</Platforms>
|
<Platforms>x64</Platforms>
|
||||||
<NeutralLanguage>en-US</NeutralLanguage>
|
<NeutralLanguage>en-US</NeutralLanguage>
|
||||||
|
<EnableNETAnalyzers>true</EnableNETAnalyzers>
|
||||||
|
<AnalysisMode>Recommended</AnalysisMode>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace Microsoft.Plugin.Uri.UriHelper
|
|||||||
const string schemeRegex = @"^([a-z][a-z0-9+\-.]*):";
|
const string schemeRegex = @"^([a-z][a-z0-9+\-.]*):";
|
||||||
if (input.EndsWith(":", StringComparison.OrdinalIgnoreCase)
|
if (input.EndsWith(":", StringComparison.OrdinalIgnoreCase)
|
||||||
&& !input.StartsWith("http", StringComparison.OrdinalIgnoreCase)
|
&& !input.StartsWith("http", StringComparison.OrdinalIgnoreCase)
|
||||||
&& !input.Contains("/", StringComparison.OrdinalIgnoreCase)
|
&& !input.Contains('/', StringComparison.OrdinalIgnoreCase)
|
||||||
&& !input.All(char.IsDigit)
|
&& !input.All(char.IsDigit)
|
||||||
&& Regex.IsMatch(input, schemeRegex))
|
&& Regex.IsMatch(input, schemeRegex))
|
||||||
{
|
{
|
||||||
@@ -60,9 +60,9 @@ namespace Microsoft.Plugin.Uri.UriHelper
|
|||||||
urlBuilder.Scheme = System.Uri.UriSchemeHttp;
|
urlBuilder.Scheme = System.Uri.UriSchemeHttp;
|
||||||
isWebUri = true;
|
isWebUri = true;
|
||||||
}
|
}
|
||||||
else if (input.Contains(":", StringComparison.OrdinalIgnoreCase) &&
|
else if (input.Contains(':', StringComparison.OrdinalIgnoreCase) &&
|
||||||
!input.StartsWith("http", StringComparison.OrdinalIgnoreCase) &&
|
!input.StartsWith("http", StringComparison.OrdinalIgnoreCase) &&
|
||||||
!input.Contains("[", StringComparison.OrdinalIgnoreCase))
|
!input.Contains('[', StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
// Do nothing, leave unchanged
|
// Do nothing, leave unchanged
|
||||||
isWebUri = false;
|
isWebUri = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user