From 74b396d7d40a3cec7652bfd7cb736d515065c6cf Mon Sep 17 00:00:00 2001 From: rafaeldamasceno Date: Sat, 8 Jun 2019 01:29:29 +0100 Subject: [PATCH] Force Scryfall URL enconding --- .../mage/plugins/card/dl/sources/ScryfallImageSource.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/ScryfallImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/ScryfallImageSource.java index da4235d931..0c2468b8df 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/ScryfallImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/ScryfallImageSource.java @@ -13,6 +13,7 @@ import org.mage.plugins.card.images.CardDownloadData; import java.io.InputStream; import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; import java.net.Proxy; import java.net.URL; import java.net.URLConnection; @@ -95,6 +96,12 @@ public enum ScryfallImageSource implements CardImageSource { } } + try { + scryfallCollectorId = URLEncoder.encode(scryfallCollectorId, "utf-8"); + } catch (UnsupportedEncodingException e) { + // URL failed to encode, this will cause download to miss in certain environments + } + baseUrl = "https://api.scryfall.com/cards/" + formatSetName(card.getSet(), isToken) + "/" + scryfallCollectorId + "/" + localizedCode + "?format=image"; alternativeUrl = "https://api.scryfall.com/cards/" + formatSetName(card.getSet(), isToken) + "/"