You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lidarr/src/NzbDrone.Common/Extensions/UrlExtensions.cs

23 lines
519 B

using System;
namespace NzbDrone.Common.Extensions
{
public static class UrlExtensions
{
public static bool IsValidUrl(this string path)
{
if (string.IsNullOrWhiteSpace(path))
{
return false;
}
if (path.StartsWith(" ") || path.EndsWith(" "))
{
return false;
}
return Uri.TryCreate(path, UriKind.Absolute, out var uri) && uri.IsWellFormedOriginalString();
}
}
}