Changed Player data export path

Previous path did not match the path used in player.html, leading to
the path not being replaced in the exported files.

Now the new path should be replaced into the files, allowing people to
view exported player.html data.

Affects issues:
- Fixed #1223
This commit is contained in:
Rsl1122 2019-11-12 19:43:22 +02:00
parent 85401b37f2
commit 852ffb81e6

View File

@ -87,7 +87,7 @@ public class PlayerPageExporter extends FileExporter {
exportRequiredResources(toDirectory);
Path playerDirectory = toDirectory.resolve("player/" + toFileName(playerName));
exportJSON(playerDirectory, playerUUID);
exportJSON(playerDirectory, playerUUID, playerName);
exportHtml(playerDirectory, playerUUID);
}
@ -102,11 +102,11 @@ public class PlayerPageExporter extends FileExporter {
}
}
private void exportJSON(Path toDirectory, UUID playerUUID) throws IOException, NotFoundException {
exportJSON(toDirectory, "player?player=" + playerUUID);
private void exportJSON(Path toDirectory, UUID playerUUID, String playerName) throws IOException, NotFoundException {
exportJSON(toDirectory, "player?player=" + playerUUID, playerName);
}
private void exportJSON(Path toDirectory, String resource) throws NotFoundException, IOException {
private void exportJSON(Path toDirectory, String resource, String playerName) throws NotFoundException, IOException {
Response found = getJSONResponse(resource);
if (found instanceof ErrorResponse) {
throw new NotFoundException(resource + " was not properly exported: " + found.getContent());
@ -115,7 +115,7 @@ public class PlayerPageExporter extends FileExporter {
String jsonResourceName = toFileName(toJSONResourceName(resource)) + ".json";
export(toDirectory.resolve(jsonResourceName), found.getContent());
exportPaths.put("../v1/" + resource, "./" + jsonResourceName);
exportPaths.put("../v1/player?player=" + playerName, "./" + jsonResourceName);
}
private String toJSONResourceName(String resource) {