mirror of
https://github.com/lidarr/Lidarr
synced 2025-02-27 00:02:25 +00:00
Fixed HttpUri parsing of domain names with underscores
This commit is contained in:
parent
1c1549820b
commit
311df71acf
2 changed files with 10 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
using NzbDrone.Test.Common;
|
using NzbDrone.Test.Common;
|
||||||
|
@ -7,6 +7,13 @@ namespace NzbDrone.Common.Test.Http
|
||||||
{
|
{
|
||||||
public class HttpUriFixture : TestBase
|
public class HttpUriFixture : TestBase
|
||||||
{
|
{
|
||||||
|
[TestCase("abc://my_host.com:8080/root/api/")]
|
||||||
|
public void should_parse(string uri)
|
||||||
|
{
|
||||||
|
var newUri = new HttpUri(uri);
|
||||||
|
newUri.FullUri.Should().Be(uri);
|
||||||
|
}
|
||||||
|
|
||||||
[TestCase("", "", "")]
|
[TestCase("", "", "")]
|
||||||
[TestCase("/", "", "/")]
|
[TestCase("/", "", "/")]
|
||||||
[TestCase("base", "", "base")]
|
[TestCase("base", "", "base")]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
@ -8,7 +8,7 @@ namespace NzbDrone.Common.Http
|
||||||
{
|
{
|
||||||
public class HttpUri : IEquatable<HttpUri>
|
public class HttpUri : IEquatable<HttpUri>
|
||||||
{
|
{
|
||||||
private static readonly Regex RegexUri = new Regex(@"^(?:(?<scheme>[a-z]+):)?(?://(?<host>[-A-Z0-9.]+)(?::(?<port>[0-9]{1,5}))?)?(?<path>(?:(?:(?<=^)|/)[^/?#\r\n]+)+/?|/)?(?:\?(?<query>[^#\r\n]*))?(?:\#(?<fragment>.*))?$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
private static readonly Regex RegexUri = new Regex(@"^(?:(?<scheme>[a-z]+):)?(?://(?<host>[-_A-Z0-9.]+)(?::(?<port>[0-9]{1,5}))?)?(?<path>(?:(?:(?<=^)|/)[^/?#\r\n]+)+/?|/)?(?:\?(?<query>[^#\r\n]*))?(?:\#(?<fragment>.*))?$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||||
|
|
||||||
private readonly string _uri;
|
private readonly string _uri;
|
||||||
public string FullUri => _uri;
|
public string FullUri => _uri;
|
||||||
|
|
Loading…
Reference in a new issue