mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 02:08:00 +00:00
Encode token url (#7983)
* Update 40K * Apply UTF-8 encoding to tokens too
This commit is contained in:
@@ -247,16 +247,7 @@ public class ImageUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String cardCollectorNumberEncoded;
|
return String.format("%s/%s/%s?format=image&version=%s%s", editionCode, encodeUtf8(cardCollectorNumber),
|
||||||
try {
|
|
||||||
cardCollectorNumberEncoded = URLEncoder.encode(cardCollectorNumber, "UTF-8");
|
|
||||||
} catch (Exception e) {
|
|
||||||
// Unlikely, for the possibility that "UTF-8" is not supported.
|
|
||||||
System.err.println("UTF-8 encoding not supported on this device.");
|
|
||||||
cardCollectorNumberEncoded = cardCollectorNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
return String.format("%s/%s/%s?format=image&version=%s%s", editionCode, cardCollectorNumberEncoded,
|
|
||||||
langCode, versionParam, faceParam);
|
langCode, versionParam, faceParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,10 +256,20 @@ public class ImageUtil {
|
|||||||
if (!faceParam.isEmpty()) {
|
if (!faceParam.isEmpty()) {
|
||||||
faceParam = (faceParam.equals("back") ? "&face=back" : "&face=front");
|
faceParam = (faceParam.equals("back") ? "&face=back" : "&face=front");
|
||||||
}
|
}
|
||||||
return String.format("%s/%s/%s?format=image&version=%s%s", setCode, collectorNumber,
|
return String.format("%s/%s/%s?format=image&version=%s%s", setCode, encodeUtf8(collectorNumber),
|
||||||
langCode, versionParam, faceParam);
|
langCode, versionParam, faceParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String encodeUtf8(String s) {
|
||||||
|
try {
|
||||||
|
return URLEncoder.encode(s, "UTF-8");
|
||||||
|
} catch (Exception e) {
|
||||||
|
// Unlikely, for the possibility that "UTF-8" is not supported.
|
||||||
|
System.err.println("UTF-8 encoding not supported on this device.");
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static String toMWSFilename(String in) {
|
public static String toMWSFilename(String in) {
|
||||||
in = StringUtils.stripAccents(in);
|
in = StringUtils.stripAccents(in);
|
||||||
final StringBuilder out = new StringBuilder();
|
final StringBuilder out = new StringBuilder();
|
||||||
|
|||||||
@@ -331,15 +331,21 @@ ScryfallCode=40K
|
|||||||
[tokens]
|
[tokens]
|
||||||
1 w_2_2_astartes_warrior_vigilance @Dmitriy Mironov
|
1 w_2_2_astartes_warrior_vigilance @Dmitriy Mironov
|
||||||
2 w_1_1_soldier @Lixin Yin
|
2 w_1_1_soldier @Lixin Yin
|
||||||
2 w_1_1_soldier @Lixin Yin
|
2★ w_1_1_soldier @Lixin Yin
|
||||||
2 w_1_1_soldier @Lixin Yin
|
3 w_1_1_soldier @Lixin Yin
|
||||||
|
3★ w_1_1_soldier @Lixin Yin
|
||||||
|
4 w_1_1_soldier @Lixin Yin
|
||||||
|
4★ w_1_1_soldier @Lixin Yin
|
||||||
9 u_1_1_tyranid_gargoyle_flying @David Astruga
|
9 u_1_1_tyranid_gargoyle_flying @David Astruga
|
||||||
12 b_2_2_astartes_warrior_menace @Helge C. Balzer
|
12 b_2_2_astartes_warrior_menace @Helge C. Balzer
|
||||||
13 cherubael @Irina Nordsol
|
13 cherubael @Irina Nordsol
|
||||||
14 b_2_2_a_necron_warrior @Games Workshop
|
14 b_2_2_a_necron_warrior @Games Workshop
|
||||||
15 plaguebearer_of_nurgle @Games Workshop
|
15 plaguebearer_of_nurgle @Games Workshop
|
||||||
|
15★ plaguebearer_of_nurgle @Games Workshop
|
||||||
16 r_3_3_spawn @Oleg Bulakh
|
16 r_3_3_spawn @Oleg Bulakh
|
||||||
|
16★ r_3_3_spawn @Oleg Bulakh
|
||||||
17 g_1_1_tyranid @Slawomir Maniak
|
17 g_1_1_tyranid @Slawomir Maniak
|
||||||
|
17★ g_1_1_tyranid @Slawomir Maniak
|
||||||
18 g_5_5_tyranid @Antonio José Manzanedo
|
18 g_5_5_tyranid @Antonio José Manzanedo
|
||||||
19 g_3_3_tyranid_warrior_trample @Sergio Cosmai
|
19 g_3_3_tyranid_warrior_trample @Sergio Cosmai
|
||||||
20 blue_horror @Andrey Nyarl
|
20 blue_horror @Andrey Nyarl
|
||||||
|
|||||||
Reference in New Issue
Block a user