mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-16 19:23:41 +01:00
Fix upload handling
This commit is contained in:
parent
6e131583dd
commit
18b768b32f
1 changed files with 9 additions and 3 deletions
|
@ -101,10 +101,10 @@ public class ServerSchematicLoader {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Path schematicPath = Paths.get(getSchematicPath()).toAbsolutePath();
|
Path playerSchematicsPath = Paths.get(getSchematicPath(), player.getGameProfile().getName()).toAbsolutePath();
|
||||||
|
|
||||||
Path uploadPath = schematicPath.resolve(playerSchematicId).normalize();
|
Path uploadPath = playerSchematicsPath.resolve(schematic).normalize();
|
||||||
if (!uploadPath.startsWith(schematicPath)) {
|
if (!uploadPath.startsWith(playerSchematicsPath)) {
|
||||||
Create.logger.warn("Attempted Schematic Upload with directory escape: {}", playerSchematicId);
|
Create.logger.warn("Attempted Schematic Upload with directory escape: {}", playerSchematicId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -123,6 +123,9 @@ public class ServerSchematicLoader {
|
||||||
if (table == null)
|
if (table == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Delete schematic with same name
|
||||||
|
Files.deleteIfExists(uploadPath);
|
||||||
|
|
||||||
// Too many Schematics
|
// Too many Schematics
|
||||||
long count;
|
long count;
|
||||||
try (Stream<Path> list = Files.list(Paths.get(playerPath))) {
|
try (Stream<Path> list = Files.list(Paths.get(playerPath))) {
|
||||||
|
@ -295,6 +298,9 @@ public class ServerSchematicLoader {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// Delete schematic with same name
|
||||||
|
Files.deleteIfExists(path);
|
||||||
|
|
||||||
// Too many Schematics
|
// Too many Schematics
|
||||||
long count;
|
long count;
|
||||||
try (Stream<Path> list = Files.list(Paths.get(playerPath))) {
|
try (Stream<Path> list = Files.list(Paths.get(playerPath))) {
|
||||||
|
|
Loading…
Reference in a new issue