mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-06-07 09:28:03 +08:00
handle numeric input (#11885)
This commit is contained in:
parent
370e8c8574
commit
3f70c8c889
@ -15,7 +15,7 @@ namespace Microsoft.Plugin.Uri.UnitTests.UriHelper
|
|||||||
[TestCase("localhost", true, "http://localhost/")]
|
[TestCase("localhost", true, "http://localhost/")]
|
||||||
[TestCase("127.0.0.1", true, "http://127.0.0.1/")]
|
[TestCase("127.0.0.1", true, "http://127.0.0.1/")]
|
||||||
[TestCase("127.0.0.1:80", true, "http://127.0.0.1/")]
|
[TestCase("127.0.0.1:80", true, "http://127.0.0.1/")]
|
||||||
[TestCase("127", true, "http://0.0.0.127/")]
|
[TestCase("127", false, null)]
|
||||||
[TestCase("", false, null)]
|
[TestCase("", false, null)]
|
||||||
[TestCase("https://google.com", true, "https://google.com/")]
|
[TestCase("https://google.com", true, "https://google.com/")]
|
||||||
[TestCase("ftps://google.com", true, "ftps://google.com/")]
|
[TestCase("ftps://google.com", true, "ftps://google.com/")]
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using Microsoft.Plugin.Uri.Interfaces;
|
using Microsoft.Plugin.Uri.Interfaces;
|
||||||
|
|
||||||
namespace Microsoft.Plugin.Uri.UriHelper
|
namespace Microsoft.Plugin.Uri.UriHelper
|
||||||
@ -21,7 +22,8 @@ namespace Microsoft.Plugin.Uri.UriHelper
|
|||||||
// Using CurrentCulture since this is a user typed string
|
// Using CurrentCulture since this is a user typed string
|
||||||
if (input.EndsWith(":", StringComparison.CurrentCulture)
|
if (input.EndsWith(":", StringComparison.CurrentCulture)
|
||||||
|| input.EndsWith(".", StringComparison.CurrentCulture)
|
|| input.EndsWith(".", StringComparison.CurrentCulture)
|
||||||
|| input.EndsWith(":/", StringComparison.CurrentCulture))
|
|| input.EndsWith(":/", StringComparison.CurrentCulture)
|
||||||
|
|| input.All(char.IsDigit))
|
||||||
{
|
{
|
||||||
result = default;
|
result = default;
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user