mirror of
https://github.com/Lidarr/Lidarr
synced 2026-05-08 12:33:04 +02:00
Fixed: Parsing URLs on some systems due to Locale
This commit is contained in:
parent
e71a563ec0
commit
98538faf39
1 changed files with 6 additions and 5 deletions
|
|
@ -6,13 +6,14 @@
|
|||
|
||||
namespace NzbDrone.Common.Http
|
||||
{
|
||||
public class HttpUri : IEquatable<HttpUri>
|
||||
public partial class HttpUri : IEquatable<HttpUri>
|
||||
{
|
||||
private static readonly Regex RegexUri = new Regex(@"^(?:(?<scheme>[a-z]+):)?(?://(?<host>[-_A-Z0-9.]+|\[[[A-F0-9:]+\])(?::(?<port>[0-9]{1,5}))?)?(?<path>(?:(?:(?<=^)|/+)[^/?#\r\n]+)+/*|/+)?(?:\?(?<query>[^#\r\n]*))?(?:\#(?<fragment>.*))?$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
private readonly string _uri;
|
||||
public string FullUri => _uri;
|
||||
|
||||
[GeneratedRegex(@"^(?:(?<scheme>[a-z]+):)?(?://(?<host>[-_A-Z0-9.]+|\[[[A-F0-9:]+\])(?::(?<port>[0-9]{1,5}))?)?(?<path>(?:(?:(?<=^)|/+)[^/?#\r\n]+)+/*|/+)?(?:\?(?<query>[^#\r\n]*))?(?:\#(?<fragment>.*))?$", RegexOptions.IgnoreCase | RegexOptions.Compiled)]
|
||||
private static partial Regex UriRegex();
|
||||
|
||||
public HttpUri(string uri)
|
||||
{
|
||||
_uri = uri ?? string.Empty;
|
||||
|
|
@ -70,9 +71,9 @@ public HttpUri(string scheme, string host, int? port, string path, string query,
|
|||
|
||||
private void Parse()
|
||||
{
|
||||
var parseSuccess = Uri.TryCreate(_uri, UriKind.RelativeOrAbsolute, out var uri);
|
||||
var parseSuccess = Uri.TryCreate(_uri, UriKind.RelativeOrAbsolute, out _);
|
||||
|
||||
var match = RegexUri.Match(_uri);
|
||||
var match = UriRegex().Match(_uri);
|
||||
|
||||
var scheme = match.Groups["scheme"];
|
||||
var host = match.Groups["host"];
|
||||
|
|
|
|||
Loading…
Reference in a new issue