diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/CardImageUrls.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/CardImageUrls.java index 1176ad3fed..e27a002cee 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/CardImageUrls.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/CardImageUrls.java @@ -2,6 +2,7 @@ package org.mage.plugins.card.dl.sources; import java.util.ArrayList; import java.util.List; +import java.util.Objects; /** * @author JayDi85 @@ -25,7 +26,10 @@ public class CardImageUrls { this.baseUrl = baseUrl; - if (alternativeUrl != null && !alternativeUrl.isEmpty()) { + if (alternativeUrl != null + && alternativeUrl != null + && !alternativeUrl.isEmpty() + && !Objects.equals(baseUrl, alternativeUrl)) { this.alternativeUrls.add(alternativeUrl); } } 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 a3e4e15055..350b79eb94 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 @@ -119,6 +119,15 @@ public enum ScryfallImageSource implements CardImageSource { + card.getCollectorId() + "/" + localizedCode + "?format=image"; alternativeUrl = "https://api.scryfall.com/cards/" + formatSetName(card.getSet(), isToken) + "/" + card.getCollectorId() + "/" + defaultCode + "?format=image"; + + // workaround to use cards without english images (some promos or special cards) + // bug: https://github.com/magefree/mage/issues/6829 + // example: Mysterious Egg from IKO https://api.scryfall.com/cards/iko/385/?format=image + if (Objects.equals(baseUrl, alternativeUrl)) { + // without loc code scryfall must return first available image + alternativeUrl = "https://api.scryfall.com/cards/" + formatSetName(card.getSet(), isToken) + "/" + + card.getCollectorId() + "/?format=image"; + } } return new CardImageUrls(baseUrl, alternativeUrl);