mirror of
https://github.com/plexusorg/Module-HTTPD.git
synced 2024-11-21 19:25:02 +00:00
uhhhh
uhhhhhh 😳
This commit is contained in:
parent
2117cf7041
commit
f8bd688fa5
@ -15,7 +15,6 @@ import java.lang.reflect.InvocationTargetException;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.text.CharacterIterator;
|
import java.text.CharacterIterator;
|
||||||
import java.text.StringCharacterIterator;
|
import java.text.StringCharacterIterator;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -28,7 +28,7 @@ public class SchematicUploadServlet extends HttpServlet
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
File[] schematics = worldeditFolder.listFiles();
|
File[] schematics = worldeditFolder.listFiles();
|
||||||
Part uploadPart = null;
|
Part uploadPart;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
uploadPart = req.getPart("file");
|
uploadPart = req.getPart("file");
|
||||||
@ -39,8 +39,11 @@ public class SchematicUploadServlet extends HttpServlet
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String filename = uploadPart.getSubmittedFileName().replaceAll("[^a-zA-Z0-9'!,_ .-]", "_");
|
String filename = uploadPart.getSubmittedFileName().replaceAll("[^a-zA-Z0-9'!,_ .-]", "_");
|
||||||
if (schemNameMatcher.matcher(filename).matches())
|
if (!schemNameMatcher.matcher(filename).matches())
|
||||||
{
|
{
|
||||||
|
resp.getWriter().println(schematicUploadBadHTML("That is not a valid schematic filename!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
boolean alreadyExists = schematics != null && Arrays.stream(schematics).anyMatch(file -> HTTPDModule.fileNameEquals(file.getName(), filename));
|
boolean alreadyExists = schematics != null && Arrays.stream(schematics).anyMatch(file -> HTTPDModule.fileNameEquals(file.getName(), filename));
|
||||||
if (alreadyExists)
|
if (alreadyExists)
|
||||||
{
|
{
|
||||||
@ -52,7 +55,6 @@ public class SchematicUploadServlet extends HttpServlet
|
|||||||
inputStream.close();
|
inputStream.close();
|
||||||
resp.getWriter().println(schematicUploadGoodHTML("Successfully uploaded <b>" + filename + "."));
|
resp.getWriter().println(schematicUploadGoodHTML("Successfully uploaded <b>" + filename + "."));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private String schematicUploadBadHTML(String message)
|
private String schematicUploadBadHTML(String message)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user