From d49cb02d2f2c089b818a66f6efb5060819c68946 Mon Sep 17 00:00:00 2001 From: kaso17 Date: Sun, 3 Dec 2017 06:47:50 +0100 Subject: [PATCH] TorrentNetwork: improve passkey handling --- src/Jackett.Common/Indexers/TorrentNetwork.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Jackett.Common/Indexers/TorrentNetwork.cs b/src/Jackett.Common/Indexers/TorrentNetwork.cs index 036f343b3..5a43083c1 100644 --- a/src/Jackett.Common/Indexers/TorrentNetwork.cs +++ b/src/Jackett.Common/Indexers/TorrentNetwork.cs @@ -145,9 +145,11 @@ namespace Jackett.Indexers APIHeaders["Authorization"] = token; var curuser = await SendAPIRequest("curuser", null); - + if (curuser.passkey.IsNullOrEmptyOrWhitespace()) + throw new ExceptionWithConfigData("got empty passkey: " + curuser.ToString(), configData); + passkey = curuser.passkey; var passkeyItem = (HiddenItem)configData.GetDynamic("passkey"); - passkeyItem.Value = curuser.passkey; + passkeyItem.Value = passkey; var tokenItem = (HiddenItem)configData.GetDynamic("token"); tokenItem.Value = token; @@ -181,6 +183,9 @@ namespace Jackett.Indexers searchUrl += "?" + queryCollection.GetQueryString(); + if (passkey.IsNullOrEmptyOrWhitespace()) + await ApplyConfiguration(null); + var result = await SendAPIRequest(searchUrl, null); try {