mirror of
https://github.com/Lidarr/Lidarr
synced 2025-12-15 12:57:14 +01:00
22 lines
519 B
C#
22 lines
519 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;
|
|
}
|
|
|
|
if (path.StartsWith(" ") || path.EndsWith(" "))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return Uri.TryCreate(path, UriKind.Absolute, out var uri) && uri.IsWellFormedOriginalString();
|
|
}
|
|
}
|
|
}
|