mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-28 12:07:35 +01:00
Improved name encoding of export filenames
This commit is contained in:
parent
5ef3c64dc3
commit
e04633d916
@ -32,6 +32,7 @@ import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Collections;
|
||||
import java.util.UUID;
|
||||
|
||||
@ -77,7 +78,7 @@ public class JSONExport extends SpecificExport {
|
||||
try {
|
||||
File htmlLocation = getPlayerFolder();
|
||||
htmlLocation.mkdirs();
|
||||
File exportFile = new File(htmlLocation, playerName.replace(" ", "%20").replace(".", "%2E") + ".json");
|
||||
File exportFile = new File(htmlLocation, URLEncoder.encode(playerName, "UTF-8") + ".json");
|
||||
|
||||
export(exportFile, Collections.singletonList(json));
|
||||
} catch (IOException e) {
|
||||
@ -94,7 +95,7 @@ public class JSONExport extends SpecificExport {
|
||||
try {
|
||||
File htmlLocation = getServerFolder();
|
||||
htmlLocation.mkdirs();
|
||||
File exportFile = new File(htmlLocation, serverName.replace(" ", "%20").replace(".", "%2E") + ".json");
|
||||
File exportFile = new File(htmlLocation, URLEncoder.encode(serverName, "UTF-8") + ".json");
|
||||
|
||||
export(exportFile, Collections.singletonList(json));
|
||||
} catch (IOException e) {
|
||||
|
@ -25,6 +25,7 @@ import com.djrapitops.plugin.api.Check;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
@ -92,7 +93,7 @@ public abstract class SpecificExport {
|
||||
protected void exportPlayerPage(String playerName, String html) throws IOException {
|
||||
List<String> lines = Arrays.asList(html.split("\n"));
|
||||
|
||||
File htmlLocation = new File(getPlayerFolder(), playerName.replace(" ", "%20").replace(".", "%2E"));
|
||||
File htmlLocation = new File(getPlayerFolder(), URLEncoder.encode(playerName, "UTF-8").replace(".", "%2E"));
|
||||
htmlLocation.mkdirs();
|
||||
File exportFile = new File(htmlLocation, "index.html");
|
||||
|
||||
@ -127,7 +128,7 @@ public abstract class SpecificExport {
|
||||
if (serverUUID.equals(serverInfo.getServerUUID())) {
|
||||
htmlLocation = new File(getFolder(), "network");
|
||||
} else {
|
||||
htmlLocation = new File(getServerFolder(), serverName.replace(" ", "%20").replace(".", "%2E"));
|
||||
htmlLocation = new File(getServerFolder(), URLEncoder.encode(serverName, "UTF-8").replace(".", "%2E"));
|
||||
html = html.replace("../", "../../");
|
||||
}
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user