cardigann: fix search paths

This commit is contained in:
Bogdan 2023-06-22 04:43:47 +03:00
parent b6398bfc1d
commit 5ebe1de282
1 changed files with 13 additions and 12 deletions

View File

@ -1414,26 +1414,27 @@ namespace Jackett.Common.Indexers
var SearchPaths = Search.Paths; var SearchPaths = Search.Paths;
foreach (var SearchPath in SearchPaths) foreach (var SearchPath in SearchPaths)
{ {
variables[".Categories"] = mappedCategories; var localMappedCategories = mappedCategories;
variables[".Categories"] = localMappedCategories;
// skip path if categories don't match // skip path if categories don't match
if (SearchPath.Categories.Count > 0) if (SearchPath.Categories.Count > 0)
{ {
var hasIntersect = mappedCategories.Intersect(SearchPath.Categories).Any(); if (localMappedCategories.Count == 0)
if (SearchPath.Categories[0] == "!")
{ {
hasIntersect = !hasIntersect; localMappedCategories = GetAllTrackerCategories();
} }
if (!hasIntersect) var categories = SearchPath.Categories[0] == "!"
{ ? localMappedCategories.Except(SearchPath.Categories).ToList()
variables[".Categories"] = mappedCategories.Except(SearchPath.Categories).ToList(); : localMappedCategories.Intersect(SearchPath.Categories).ToList();
if (!categories.Any())
{
continue; continue;
} }
variables[".Categories"] = mappedCategories.Intersect(SearchPath.Categories).ToList(); variables[".Categories"] = categories;
} }
// build search URL // build search URL
@ -1484,11 +1485,11 @@ namespace Jackett.Common.Indexers
} }
} }
if (method == RequestType.GET) if (method == RequestType.GET && queryCollection.Count > 0)
{ {
if (queryCollection.Count > 0) searchUrl += "?" + queryCollection.GetQueryString(Encoding);
searchUrl += "?" + queryCollection.GetQueryString(Encoding);
} }
var searchUrlUri = new Uri(searchUrl); var searchUrlUri = new Uri(searchUrl);
// send HTTP request // send HTTP request