Merge pull request #5839 from rafaeldamasceno/scryfall-encoding-fix

Force Scryfall URL enconding
This commit is contained in:
Oleg Agafonov 2019-06-08 22:43:59 +02:00 committed by GitHub
commit ff3f02d780
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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) + "/"