From d7b5100e3581048861c1ced0af9b2c3e25991095 Mon Sep 17 00:00:00 2001 From: Qstick Date: Thu, 3 Feb 2022 23:32:25 -0600 Subject: [PATCH] Fixed: (Cardigann) Smarter redirect domain compare Fixes #808 --- .../Definitions/Cardigann/CardigannRequestGenerator.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannRequestGenerator.cs index 1af2cb641..e7f360c02 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannRequestGenerator.cs @@ -647,10 +647,13 @@ namespace NzbDrone.Core.Indexers.Cardigann protected string GetRedirectDomainHint(string requestUrl, string redirectUrl) { - if (requestUrl.StartsWith(SiteLink) && !redirectUrl.StartsWith(SiteLink)) + var siteLinkUri = new HttpUri(SiteLink); + var requestUri = new HttpUri(requestUrl); + var redirectUri = new HttpUri(redirectUrl); + + if (requestUri.Host.StartsWith(siteLinkUri.Host) && !redirectUri.Host.StartsWith(siteLinkUri.Host)) { - var uri = new HttpUri(redirectUrl); - return uri.Scheme + "://" + uri.Host + "/"; + return redirectUri.Scheme + "://" + redirectUri.Host + "/"; } return null;