From 9a098d45a555e5d660c41e04f64e9445420cc025 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Sun, 26 May 2019 19:53:05 +0200 Subject: [PATCH] fix FimFictionApi error on Android --- .../fanfix/supported/FimfictionApi.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/be/nikiroo/fanfix/supported/FimfictionApi.java b/src/be/nikiroo/fanfix/supported/FimfictionApi.java index a64e4c0..c97ecf7 100644 --- a/src/be/nikiroo/fanfix/supported/FimfictionApi.java +++ b/src/be/nikiroo/fanfix/supported/FimfictionApi.java @@ -147,12 +147,20 @@ class FimfictionApi extends BasicSupport { if (!coverImageLink.trim().isEmpty()) { URL coverImageUrl = new URL(coverImageLink.trim()); - InputStream in = Instance.getCache() - .open(coverImageUrl, this, true); + // No need to use the oauth, cookies... for the cover + // Plus: it crashes on Android because of the referer try { - meta.setCover(new Image(in)); - } finally { - in.close(); + InputStream in = Instance.getCache().open(coverImageUrl, null, + true); + try { + meta.setCover(new Image(in)); + } finally { + in.close(); + } + } catch (IOException e) { + Instance.getTraceHandler().error( + new IOException( + "Cannot get the story cover, ignoring...", e)); } } -- 2.27.0