mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-30 10:05:59 +00:00
Tweak filename rule.
This commit is contained in:
parent
3c9245bfaf
commit
b845ff3f7e
@ -23,14 +23,14 @@ public class Module_schematic extends TFM_HTTPD_Module
|
|||||||
{
|
{
|
||||||
private static final File SCHEMATIC_FOLDER = new File("./plugins/WorldEdit/schematics/");
|
private static final File SCHEMATIC_FOLDER = new File("./plugins/WorldEdit/schematics/");
|
||||||
private static final String REQUEST_FORM_FILE_ELEMENT_NAME = "schematicFile";
|
private static final String REQUEST_FORM_FILE_ELEMENT_NAME = "schematicFile";
|
||||||
private static final Pattern SCHEMATIC_FILENAME_LC = Pattern.compile("^[a-z0-9]{5,30}\\.schematic$");
|
private static final Pattern SCHEMATIC_FILENAME_LC = Pattern.compile("^[a-z0-9]{1,30}\\.schematic$");
|
||||||
private static final String[] SCHEMATIC_FILTER = new String[]
|
private static final String[] SCHEMATIC_FILTER = new String[]
|
||||||
{
|
{
|
||||||
"schematic"
|
"schematic"
|
||||||
};
|
};
|
||||||
private static final String UPLOAD_FORM =
|
private static final String UPLOAD_FORM =
|
||||||
"<form method=\"post\" name=\"schematicForm\" id=\"schematicForm\" action=\"/schematic/upload/\" enctype=\"multipart/form-data\">\n"
|
"<form method=\"post\" name=\"schematicForm\" id=\"schematicForm\" action=\"/schematic/upload/\" enctype=\"multipart/form-data\">\n"
|
||||||
+ "<p>Select a schematic file to upload. Filenames must be alphanumeric, between 5 and 30 characters long (inclusive), and have a .schematic extension.</p>\n"
|
+ "<p>Select a schematic file to upload. Filenames must be alphanumeric, between 1 and 30 characters long (inclusive), and have a .schematic extension.</p>\n"
|
||||||
+ "<input type=\"file\" id=\"schematicFile\" name=\"schematicFile\" />\n"
|
+ "<input type=\"file\" id=\"schematicFile\" name=\"schematicFile\" />\n"
|
||||||
+ "<br />\n"
|
+ "<br />\n"
|
||||||
+ "<button type=\"submit\">Submit</button>\n"
|
+ "<button type=\"submit\">Submit</button>\n"
|
||||||
@ -178,7 +178,7 @@ public class Module_schematic extends TFM_HTTPD_Module
|
|||||||
|
|
||||||
if (!SCHEMATIC_FILENAME_LC.matcher(origFileName.toLowerCase()).find())
|
if (!SCHEMATIC_FILENAME_LC.matcher(origFileName.toLowerCase()).find())
|
||||||
{
|
{
|
||||||
throw new SchematicTransferException("File name must be alphanumeric with a \".schematic\" extension.");
|
throw new SchematicTransferException("File name must be alphanumeric, between 1 and 30 characters long (inclusive), and have a \".schematic\" extension.");
|
||||||
}
|
}
|
||||||
|
|
||||||
final File targetFile = new File(SCHEMATIC_FOLDER.getPath(), origFileName);
|
final File targetFile = new File(SCHEMATIC_FOLDER.getPath(), origFileName);
|
||||||
|
Loading…
Reference in New Issue
Block a user