mejortorrent: support use of special characters (#13761)

also add colon as a supported character inside TorznabQueries

Co-authored-by: ilike2burnthing <59480337+ilike2burnthing@users.noreply.github.com>
This commit is contained in:
Lucas Nicora 2022-12-09 01:16:57 +01:00 committed by GitHub
parent 9006f3c330
commit 22e933bdb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -92,7 +92,8 @@ namespace Jackett.Common.Indexers
MusicSearchParams = new List<MusicSearchParam>
{
MusicSearchParam.Q
}
},
SupportsRawSearch = true
},
configService: configService,
client: w,
@ -415,7 +416,7 @@ namespace Jackett.Common.Indexers
return queryWords.All(word => titleWords.Contains(word));
}
private static TorznabQuery ParseQuery(TorznabQuery query)
private TorznabQuery ParseQuery(TorznabQuery query)
{
// Eg. Doctor.Who.2005.(Доктор.Кто).S02E08
@ -425,9 +426,10 @@ namespace Jackett.Common.Indexers
// query.Episode = 8
var searchTerm = query.GetQueryString();
// replace non-english alphanumeric characters with spaces
// Server returns a 500 error if a UTF character higher than \u00FF (ÿ) is included,
// so we need to strip them
// searchTerm = Doctor Who 2005
searchTerm = Regex.Replace(searchTerm, @"[^a-zA-Z0-9]+", " ");
searchTerm = Regex.Replace(searchTerm, @"[^\u0001-\u00FF]+", " ");
searchTerm = Regex.Replace(searchTerm, @"\s+", " ");
searchTerm = searchTerm.Trim();

View File

@ -94,6 +94,7 @@ namespace Jackett.Common.Models
|| c == ']'
|| c == '+'
|| c == '%'
|| c == ':'
));
return string.Concat(safeTitle);
}