From 1c1144f8c502798e22e9bc89dd09cf43af9d8090 Mon Sep 17 00:00:00 2001 From: Qstick Date: Tue, 2 Mar 2021 00:36:00 -0500 Subject: [PATCH] Change redirect type to 301 (Perm) --- src/Prowlarr.Api.V1/Indexers/IndexerModule.cs | 4 ++-- src/Prowlarr.Http/ErrorManagement/ErrorHandler.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Prowlarr.Api.V1/Indexers/IndexerModule.cs b/src/Prowlarr.Api.V1/Indexers/IndexerModule.cs index 9f3adb505..a6f1fdfd4 100644 --- a/src/Prowlarr.Api.V1/Indexers/IndexerModule.cs +++ b/src/Prowlarr.Api.V1/Indexers/IndexerModule.cs @@ -123,7 +123,7 @@ private object GetDownload(int id) if (indexer.SupportsRedirect && indexerDef.Redirect) { _downloadService.RecordRedirect(unprotectedlLink, id, source, file); - return Response.AsRedirect(unprotectedlLink); + return Response.AsRedirect(unprotectedlLink, Nancy.Responses.RedirectResponse.RedirectType.Permanent); } var downloadBytes = Array.Empty(); @@ -140,7 +140,7 @@ private object GetDownload(int id) && downloadBytes[6] == 0x3a) { var magnetUrl = Encoding.UTF8.GetString(downloadBytes); - return Response.AsRedirect(magnetUrl); + return Response.AsRedirect(magnetUrl, Nancy.Responses.RedirectResponse.RedirectType.Permanent); } var contentType = indexer.Protocol == DownloadProtocol.Torrent ? "application/x-bittorrent" : "application/x-nzb"; diff --git a/src/Prowlarr.Http/ErrorManagement/ErrorHandler.cs b/src/Prowlarr.Http/ErrorManagement/ErrorHandler.cs index 5863c5dfb..cade63fe1 100644 --- a/src/Prowlarr.Http/ErrorManagement/ErrorHandler.cs +++ b/src/Prowlarr.Http/ErrorManagement/ErrorHandler.cs @@ -1,4 +1,4 @@ -using Nancy; +using Nancy; using Nancy.ErrorHandling; using Prowlarr.Http.Extensions; @@ -13,7 +13,7 @@ public bool HandlesStatusCode(HttpStatusCode statusCode, NancyContext context) public void Handle(HttpStatusCode statusCode, NancyContext context) { - if (statusCode == HttpStatusCode.SeeOther || statusCode == HttpStatusCode.OK) + if (statusCode == HttpStatusCode.SeeOther || statusCode == HttpStatusCode.MovedPermanently || statusCode == HttpStatusCode.OK) { return; }