Update SchematicDownloadEndpoint.java

This commit is contained in:
Telesphoreo 2022-04-17 19:21:12 -05:00
parent 3fa54cec72
commit 1802d91fad

View file

@ -68,7 +68,10 @@ public class SchematicDownloadEndpoint extends AbstractServlet
try try
{ {
byte[] schemData = HTTPDModule.fileCache.getFile(schemFile); byte[] schemData = HTTPDModule.fileCache.getFile(schemFile);
if (schemData != null) outputStream.write(schemData); if (schemData != null)
{
outputStream.write(schemData);
}
} }
catch (IOException ignored) catch (IOException ignored)
{ {
@ -92,8 +95,9 @@ public class SchematicDownloadEndpoint extends AbstractServlet
Arrays.sort(alphabetical); Arrays.sort(alphabetical);
for (File worldeditFile : alphabetical) for (File worldeditFile : alphabetical)
{ {
String sanitizedName = worldeditFile.getName().replaceAll("<[^>]*>", "");
sb.append("<tr>" + sb.append("<tr>" +
"<th scope=\"row\"><a href=\"" + worldeditFile.getName() + "\" download>" + worldeditFile.getName() + "</a></th>" + "<th scope=\"row\"><a href=\"" + worldeditFile.getName() + "\" download>" + sanitizedName + "</a></th>" +
"<td>" + formattedSize(worldeditFile.length()) + "</td>" + "<td>" + formattedSize(worldeditFile.length()) + "</td>" +
"</tr>"); "</tr>");
} }