diff --git a/src/me/StevenLawson/TotalFreedomMod/HTTPD/Module_schematic.java b/src/me/StevenLawson/TotalFreedomMod/HTTPD/Module_schematic.java index 48d1a1c8..1b7df565 100644 --- a/src/me/StevenLawson/TotalFreedomMod/HTTPD/Module_schematic.java +++ b/src/me/StevenLawson/TotalFreedomMod/HTTPD/Module_schematic.java @@ -22,13 +22,13 @@ public class Module_schematic extends TFM_HTTPD_Module { private static final File SCHEMATIC_FOLDER = new File("./plugins/WorldEdit/schematics/"); private static final String REQUEST_FORM_FILE_ELEMENT_NAME = "schematicFile"; - private static final Pattern SCHEMATIC_FILENAME_LC = Pattern.compile("^[a-z0-9]{1,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[] { "schematic" }; - private static final String UPLOAD_FORM = - "
\n" + private static final String UPLOAD_FORM + = "\n" + "

Select a schematic file to upload. Filenames must be alphanumeric, between 1 and 30 characters long (inclusive), and have a .schematic extension.

\n" + "\n" + "
\n" @@ -80,7 +80,15 @@ public class Module_schematic extends TFM_HTTPD_Module for (File schematic : schematics) { String filename = StringEscapeUtils.escapeHtml4(schematic.getName()); - schematicsFormatted.add("
  • " + filename + "
  • "); + + if (SCHEMATIC_FILENAME_LC.matcher(filename.trim().toLowerCase()).find()) + { + schematicsFormatted.add("
  • " + filename + "
  • "); + } + else + { + schematicsFormatted.add("
  • " + filename + " - (Illegal filename, can't download)
  • "); + } } Collections.sort(schematicsFormatted, new Comparator()