mirror of https://github.com/lidarr/Lidarr
30 lines
574 B
C#
30 lines
574 B
C#
using System;
|
|
|
|
namespace NzbDrone.Common.Extensions
|
|
{
|
|
public static class UrlExtensions
|
|
{
|
|
public static bool IsValidUrl(this string path)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(path))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
Uri uri;
|
|
if (!Uri.TryCreate(path, UriKind.Absolute, out uri))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
if (!uri.IsWellFormedOriginalString())
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
}
|
|
}
|