From 5a2718a14b2392a92024c59a79a68b0c4972558f Mon Sep 17 00:00:00 2001 From: Garfield69 Date: Mon, 23 Oct 2023 07:14:59 +1300 Subject: [PATCH] gazelletracker: support legacy apiKeyLength #14791 --- src/Jackett.Common/Indexers/Abstract/GazelleTracker.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Jackett.Common/Indexers/Abstract/GazelleTracker.cs b/src/Jackett.Common/Indexers/Abstract/GazelleTracker.cs index 881334d22..43ab2f6c4 100644 --- a/src/Jackett.Common/Indexers/Abstract/GazelleTracker.cs +++ b/src/Jackett.Common/Indexers/Abstract/GazelleTracker.cs @@ -33,6 +33,7 @@ namespace Jackett.Common.Indexers.Abstract protected virtual string AuthorizationName => "Authorization"; protected virtual string AuthorizationFormat => "{0}"; protected virtual int ApiKeyLength => 41; + protected virtual int ApiKeyLengthLegacy => 0; protected virtual string FlipOptionalTokenString(string requestLink) => requestLink.Replace("&usetoken=1", ""); protected bool useTokens; @@ -89,8 +90,10 @@ namespace Jackett.Common.Indexers.Abstract var apiKey = configData.ApiKey; if (apiKey?.Value == null) throw new Exception("Invalid API Key configured"); - if (apiKey.Value.Length != ApiKeyLength) + if (ApiKeyLengthLegacy == 0 && apiKey.Value.Length != ApiKeyLength) throw new Exception($"Invalid API Key configured: expected length: {ApiKeyLength}, got {apiKey.Value.Length}"); + if (ApiKeyLengthLegacy != 0 && apiKey.Value.Length != ApiKeyLength && apiKey.Value.Length != ApiKeyLengthLegacy) + throw new Exception($"Invalid API Key configured: expected length: {ApiKeyLength} or {ApiKeyLengthLegacy}, got {apiKey.Value.Length}"); try {