From 37bc4f0b045fed416be7c0fcf46256a080768306 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Thu, 26 Aug 2021 12:09:47 +0200 Subject: [PATCH] Sanitize ResourceLocation error logging --- .../resources/ResourceLocation.java.patch | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/paper-server/patches/sources/net/minecraft/resources/ResourceLocation.java.patch b/paper-server/patches/sources/net/minecraft/resources/ResourceLocation.java.patch index 6c86c31123..db09bb8255 100644 --- a/paper-server/patches/sources/net/minecraft/resources/ResourceLocation.java.patch +++ b/paper-server/patches/sources/net/minecraft/resources/ResourceLocation.java.patch @@ -8,3 +8,21 @@ private final String namespace; private final String path; +@@ -246,7 +247,7 @@ + + private static String assertValidNamespace(String namespace, String path) { + if (!isValidNamespace(namespace)) { +- throw new ResourceLocationException("Non [a-z0-9_.-] character in namespace of location: " + namespace + ":" + path); ++ throw new ResourceLocationException("Non [a-z0-9_.-] character in namespace of location: " + org.apache.commons.lang3.StringUtils.normalizeSpace(namespace) + ":" + org.apache.commons.lang3.StringUtils.normalizeSpace(path)); // Paper - Sanitize ResourceLocation error logging + } else { + return namespace; + } +@@ -267,7 +268,7 @@ + + private static String assertValidPath(String namespace, String path) { + if (!isValidPath(path)) { +- throw new ResourceLocationException("Non [a-z0-9/._-] character in path of location: " + namespace + ":" + path); ++ throw new ResourceLocationException("Non [a-z0-9/._-] character in path of location: " + namespace + ":" + org.apache.commons.lang3.StringUtils.normalizeSpace(path)); // Paper - Sanitize ResourceLocation error logging + } else { + return path; + }