commit c182583e09fc94cdc8127fcb04f6fe2b05f8443a
parent d821389c2e838c1533bc9e1f5757a5c5719b05e0
Author: Daniel GarcĂa <dani-garcia@users.noreply.github.com>
Date: Sat, 5 Oct 2019 16:17:43 +0200
Merge pull request #644 from BlackDex/issue-565
Fixed issue #565
Diffstat:
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/api/icons.rs b/src/api/icons.rs
@@ -253,12 +253,20 @@ fn get_page(url: &str) -> Result<Response, Error> {
}
fn get_page_with_cookies(url: &str, cookie_str: &str) -> Result<Response, Error> {
- 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.