From 27518a27fb06f26b5cacdd25bbcea60d51093fa6 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Mon, 31 Jul 2023 17:31:33 +0300 Subject: [PATCH] Fixed: (FileList) Prevent double query escaping and category IDs correction --- .../Indexers/FileList/FileListRequestGenerator.cs | 9 +++++++-- .../Indexers/FileList/FileListSettings.cs | 14 +++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/NzbDrone.Core/Indexers/FileList/FileListRequestGenerator.cs b/src/NzbDrone.Core/Indexers/FileList/FileListRequestGenerator.cs index df7c47dba..37c421456 100644 --- a/src/NzbDrone.Core/Indexers/FileList/FileListRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/FileList/FileListRequestGenerator.cs @@ -23,7 +23,10 @@ namespace NzbDrone.Core.Indexers.FileList { var pageableRequests = new IndexerPageableRequestChain(); - pageableRequests.Add(GetRequest("search-torrents", Settings.Categories, string.Format("&type=name&query={0}+{1}", Uri.EscapeDataString(searchCriteria.CleanArtistQuery.Trim()), Uri.EscapeDataString(searchCriteria.CleanAlbumQuery.Trim())))); + var artistQuery = searchCriteria.CleanArtistQuery.Replace("+", " ").Trim(); + var albumQuery = searchCriteria.CleanAlbumQuery.Replace("+", " ").Trim(); + + pageableRequests.Add(GetRequest("search-torrents", Settings.Categories, string.Format("&type=name&query={0}+{1}", Uri.EscapeDataString(artistQuery), Uri.EscapeDataString(albumQuery)))); return pageableRequests; } @@ -32,7 +35,9 @@ namespace NzbDrone.Core.Indexers.FileList { var pageableRequests = new IndexerPageableRequestChain(); - pageableRequests.Add(GetRequest("search-torrents", Settings.Categories, string.Format("&type=name&query={0}", Uri.EscapeDataString(searchCriteria.CleanArtistQuery.Trim())))); + var artistQuery = searchCriteria.CleanArtistQuery.Replace("+", " ").Trim(); + + pageableRequests.Add(GetRequest("search-torrents", Settings.Categories, string.Format("&type=name&query={0}", Uri.EscapeDataString(artistQuery)))); return pageableRequests; } diff --git a/src/NzbDrone.Core/Indexers/FileList/FileListSettings.cs b/src/NzbDrone.Core/Indexers/FileList/FileListSettings.cs index e20f72eeb..e2e919265 100644 --- a/src/NzbDrone.Core/Indexers/FileList/FileListSettings.cs +++ b/src/NzbDrone.Core/Indexers/FileList/FileListSettings.cs @@ -26,10 +26,10 @@ namespace NzbDrone.Core.Indexers.FileList BaseUrl = "https://filelist.io"; MinimumSeeders = IndexerDefaults.MINIMUM_SEEDERS; - Categories = new int[] + Categories = new[] { - (int)FileListCategories.AUDIO, - (int)FileListCategories.FLAC + (int)FileListCategories.Audio, + (int)FileListCategories.Flac }; } @@ -62,9 +62,9 @@ namespace NzbDrone.Core.Indexers.FileList public enum FileListCategories { - [FieldOption] - AUDIO = 5, - [FieldOption] - FLAC = 11 + [FieldOption(Label = "FLAC")] + Flac = 5, + [FieldOption(Label = "Audio")] + Audio = 11 } }