From 58ed9767374440e98a885d080e4ba94086c2649f Mon Sep 17 00:00:00 2001 From: glax Date: Mon, 16 Jun 2025 00:10:28 +0200 Subject: [PATCH] HttpDownloadClient Check if original uri is equal to final uri --- API/MangaDownloadClients/HttpDownloadClient.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/API/MangaDownloadClients/HttpDownloadClient.cs b/API/MangaDownloadClients/HttpDownloadClient.cs index 6bf5e3f..2c67632 100644 --- a/API/MangaDownloadClients/HttpDownloadClient.cs +++ b/API/MangaDownloadClients/HttpDownloadClient.cs @@ -20,9 +20,10 @@ internal class HttpDownloadClient : DownloadClient if (clickButton is not null) Log.Warn("Client can not click button"); HttpResponseMessage? response = null; + Uri uri = new(url); while (response is null) { - HttpRequestMessage requestMessage = new(HttpMethod.Get, url); + HttpRequestMessage requestMessage = new(HttpMethod.Get, uri); if (referrer is not null) requestMessage.Headers.Referrer = new (referrer); Log.Debug($"Requesting {url}"); @@ -64,7 +65,7 @@ internal class HttpDownloadClient : DownloadClient } // Request has been redirected to another page. For example, it redirects directly to the results when there is only 1 result - if (response.RequestMessage is not null && response.RequestMessage.RequestUri is not null) + if (response.RequestMessage is not null && response.RequestMessage.RequestUri is not null && response.RequestMessage.RequestUri != uri) { return new (response.StatusCode, document, stream, true, response.RequestMessage.RequestUri.AbsoluteUri); }