mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
Fixed filenames that contains comma and apostrophe when parsed (as seen on achievement resource when downloaded, "%27s" will be replaced by "'s" and %2C" will be replaced by ","), so they can be viewable on achievement page.
This commit is contained in:
@@ -126,6 +126,8 @@ public abstract class AchievementCollection implements Iterable<Achievement> {
|
|||||||
for (final String s : achievementListFile) {
|
for (final String s : achievementListFile) {
|
||||||
if (!s.isEmpty()) {
|
if (!s.isEmpty()) {
|
||||||
String k[] = StringUtils.split(s, "|");
|
String k[] = StringUtils.split(s, "|");
|
||||||
|
if(k[0].contains("add(\""))
|
||||||
|
k[0] = k[0].replace("add(\"","");
|
||||||
add(k[0],k[1],k[2]);
|
add(k[0],k[1],k[2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -242,7 +242,9 @@ public abstract class GuiDownloadService implements Runnable {
|
|||||||
count++;
|
count++;
|
||||||
cardSkipped = true; //assume skipped unless saved successfully
|
cardSkipped = true; //assume skipped unless saved successfully
|
||||||
String url = kv.getValue();
|
String url = kv.getValue();
|
||||||
final File fileDest = new File(kv.getKey());
|
//replace web url punctuation by their real punctuation...
|
||||||
|
String renamedKey = kv.getKey().replace("%2C",",").replace("%27s","'s");
|
||||||
|
final File fileDest = new File(renamedKey);
|
||||||
|
|
||||||
System.out.println(count + "/" + totalCount + " - " + fileDest);
|
System.out.println(count + "/" + totalCount + " - " + fileDest);
|
||||||
|
|
||||||
@@ -331,7 +333,7 @@ public abstract class GuiDownloadService implements Runnable {
|
|||||||
|
|
||||||
protected static void addMissingItems(Map<String, String> list, String nameUrlFile, String dir) {
|
protected static void addMissingItems(Map<String, String> list, String nameUrlFile, String dir) {
|
||||||
for (Pair<String, String> nameUrlPair : FileUtil.readNameUrlFile(nameUrlFile)) {
|
for (Pair<String, String> nameUrlPair : FileUtil.readNameUrlFile(nameUrlFile)) {
|
||||||
File f = new File(dir, nameUrlPair.getLeft());
|
File f = new File(dir, nameUrlPair.getLeft().replace("%2C",",").replace("%27s","'s"));
|
||||||
//System.out.println(f.getAbsolutePath());
|
//System.out.println(f.getAbsolutePath());
|
||||||
if (!f.exists()) {
|
if (!f.exists()) {
|
||||||
list.put(f.getAbsolutePath(), nameUrlPair.getRight());
|
list.put(f.getAbsolutePath(), nameUrlPair.getRight());
|
||||||
|
|||||||
Reference in New Issue
Block a user