mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-22 22:14:44 -04:00
28f64d9a46
(cherry picked from commit 40e54685b9e83ed24a3979bfe965c453339ad02e)
23 lines
519 B
C#
23 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();
|
|
}
|
|
}
|
|
}
|