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:
kevlahnota
2017-08-28 07:54:15 +00:00
parent 9d9ef0069a
commit aa1d2a1879
2 changed files with 6 additions and 2 deletions

View File

@@ -126,6 +126,8 @@ public abstract class AchievementCollection implements Iterable<Achievement> {
for (final String s : achievementListFile) {
if (!s.isEmpty()) {
String k[] = StringUtils.split(s, "|");
if(k[0].contains("add(\""))
k[0] = k[0].replace("add(\"","");
add(k[0],k[1],k[2]);
}
}

View File

@@ -242,7 +242,9 @@ public abstract class GuiDownloadService implements Runnable {
count++;
cardSkipped = true; //assume skipped unless saved successfully
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);
@@ -331,7 +333,7 @@ public abstract class GuiDownloadService implements Runnable {
protected static void addMissingItems(Map<String, String> list, String nameUrlFile, String dir) {
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());
if (!f.exists()) {
list.put(f.getAbsolutePath(), nameUrlPair.getRight());