Merge commit '3519cb5c518d569235beaedfc3071cba45ec848d'
[nikiroo-utils.git] / src / be / nikiroo / fanfix / supported / FimfictionApi.java
index 887f5f9c121397a4b8e90d7023c8d1ffac073f9b..c97ecf7d3e9ea2ff8a7cc782eea5bca660f9f265 100644 (file)
@@ -145,13 +145,22 @@ class FimfictionApi extends BasicSupport {
                String coverImageLink = getKeyJson(json, 0, "type", "story",
                                "cover_image", "full");
                if (!coverImageLink.trim().isEmpty()) {
-                       InputStream in = null;
+                       URL coverImageUrl = new URL(coverImageLink.trim());
+
+                       // No need to use the oauth, cookies... for the cover
+                       // Plus: it crashes on Android because of the referer
                        try {
-                               URL coverImageUrl = new URL(coverImageLink.trim());
-                               in = Instance.getCache().open(coverImageUrl, this, true);
-                               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));
                        }
                }