From be2916333b7db2837c8f0ce2367ff3996c11d781 Mon Sep 17 00:00:00 2001 From: BlackDex Date: Sat, 5 Oct 2019 15:45:09 +0200 Subject: [PATCH] Fixed issue #565 Issue fixed by omitting the cookie header when cookie_str is empty --- src/api/icons.rs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/api/icons.rs b/src/api/icons.rs index 39475d0..8674793 100644 --- a/src/api/icons.rs +++ b/src/api/icons.rs @@ -253,12 +253,20 @@ fn get_page(url: &str) -> Result { } fn get_page_with_cookies(url: &str, cookie_str: &str) -> Result { - CLIENT - .get(url) - .header("cookie", cookie_str) - .send()? - .error_for_status() - .map_err(Into::into) + if cookie_str.is_empty() { + CLIENT + .get(url) + .send()? + .error_for_status() + .map_err(Into::into) + } else { + CLIENT + .get(url) + .header("cookie", cookie_str) + .send()? + .error_for_status() + .map_err(Into::into) + } } /// Returns a Integer with the priority of the type of the icon which to prefer.