Your ROOT_URL in app.ini is https://git.cloudchain.link/ but you are visiting https://dash.bss.nz/open-source-mirrors/Sonarr/commit/502298aab96099a8445532c59eb37867e8576887?style=split&whitespace=show-all
You should set ROOT_URL correctly, otherwise the web may not work correctly.
3 changed files with
33 additions and
15 deletions
@ -0,0 +1,29 @@
using FluentAssertions ;
using NUnit.Framework ;
using NzbDrone.Common.Http ;
using NzbDrone.Test.Common ;
namespace NzbDrone.Common.Test.Http
{
public class HttpUriFixture : TestBase
{
private HttpUri GivenHttpUri ( string basePath )
{
return new HttpUri ( "http" , "localhost" , 8989 , basePath , null , null ) ;
}
[TestCase("", "", "")]
[TestCase("base", "", "/base")]
[TestCase("/base", "", "/base")]
[TestCase("", "relative", "/relative")]
[TestCase("", "/relative", "/relative")]
[TestCase("base", "relative", "/base/relative")]
[TestCase("base", "/relative", "/base/relative")]
[TestCase("/base", "relative", "/base/relative")]
[TestCase("/base", "/relative", "/base/relative")]
public void should_combine_base_path_and_relative_path ( string basePath , string relativePath , string expected )
{
GivenHttpUri ( basePath ) . CombinePath ( relativePath ) . Path . Should ( ) . Be ( expected ) ;
}
}
}
@ -83,6 +83,7 @@
<Compile Include= "Http\HttpClientFixture.cs" />
<Compile Include= "Http\HttpClientFixture.cs" />
<Compile Include= "Http\HttpRequestBuilderFixture.cs" />
<Compile Include= "Http\HttpRequestBuilderFixture.cs" />
<Compile Include= "Http\HttpRequestFixture.cs" />
<Compile Include= "Http\HttpRequestFixture.cs" />
<Compile Include= "Http\HttpUriFixture.cs" />
<Compile Include= "InstrumentationTests\CleanseLogMessageFixture.cs" />
<Compile Include= "InstrumentationTests\CleanseLogMessageFixture.cs" />
<Compile Include= "LevenshteinDistanceFixture.cs" />
<Compile Include= "LevenshteinDistanceFixture.cs" />
<Compile Include= "OsPathFixture.cs" />
<Compile Include= "OsPathFixture.cs" />
@ -144,23 +144,12 @@ namespace NzbDrone.Common.Http
return basePath ;
return basePath ;
}
}
var newPath = "/" + relativePath . TrimStart ( '/' ) ;
if ( basePath . IsNullOrWhiteSpace ( ) )
if ( basePath ! = null & & ! relativePath . StartsWith ( "/" ) )
{
{
var baseSlashIndex = basePath . LastIndexOf ( '/' ) ;
return "/" + relativePath . TrimStart ( '/' ) ;
if ( baseSlashIndex = = basePath . Length - 1 )
{
newPath = basePath . TrimEnd ( '/' ) + newPath ;
}
else if ( baseSlashIndex ! = 0 )
{
newPath = basePath . Substring ( 0 , baseSlashIndex ) + newPath ;
}
}
}
return newPath ;
return basePath . TrimEnd ( "/" ) + "/" + relativePath . TrimStart ( '/' ) ;
}
}
public HttpUri SetQuery ( string query )
public HttpUri SetQuery ( string query )
@ -199,7 +188,6 @@ namespace NzbDrone.Common.Http
return SetQuery ( builder . ToString ( ) ) ;
return SetQuery ( builder . ToString ( ) ) ;
}
}
public override int GetHashCode ( )
public override int GetHashCode ( )
{
{
return _uri . GetHashCode ( ) ;
return _uri . GetHashCode ( ) ;