fix(furnidata): correct revert audit enum, sanitize audit values, config-driven maxBytes

This commit is contained in:
simoleo89
2026-06-06 02:28:26 +02:00
parent f55b182d8e
commit 50444003bb
3 changed files with 6 additions and 6 deletions
@@ -71,7 +71,7 @@ public class FurnitureTextProvider {
/** Returns the byte cap used when reading furnidata files. */ /** Returns the byte cap used when reading furnidata files. */
public long getMaxBytes() { public long getMaxBytes() {
return DEFAULT_MAX_BYTES; return Long.parseLong(com.eu.habbo.Emulator.getConfig().getValue("items.furnidata.max.bytes", String.valueOf(DEFAULT_MAX_BYTES)));
} }
/** /**
@@ -155,7 +155,7 @@ public class FurnitureTextProvider {
* furni names (controlled, predominantly ASCII source). Lone/astral surrogates are not * furni names (controlled, predominantly ASCII source). Lone/astral surrogates are not
* specially handled. * specially handled.
*/ */
static String sanitize(String value) { public static String sanitize(String value) {
if (value == null) return ""; if (value == null) return "";
StringBuilder sb = new StringBuilder(Math.min(value.length(), MAX_LEN)); StringBuilder sb = new StringBuilder(Math.min(value.length(), MAX_LEN));
for (int i = 0; i < value.length() && sb.length() < MAX_LEN; i++) { for (int i = 0; i < value.length() && sb.length() < MAX_LEN; i++) {
@@ -95,7 +95,7 @@ public class FurniEditorRevertFurnidataEvent extends MessageHandler {
FurnidataAuditLog.record( FurnidataAuditLog.record(
adminId, adminId,
classnameForLog, classnameForLog,
"REVERT_FURNIDATA", "revert",
"", // previous state unknown at this point "", // previous state unknown at this point
"", "",
"", "",
@@ -143,11 +143,11 @@ public class FurniEditorUpdateFurnidataEvent extends MessageHandler {
FurnidataAuditLog.record( FurnidataAuditLog.record(
adminId, adminId,
classname, classname,
"UPDATE_FURNIDATA", "edit",
oldName != null ? oldName : "", oldName != null ? oldName : "",
safeName, FurnitureTextProvider.sanitize(safeName),
oldDesc, oldDesc,
safeDesc FurnitureTextProvider.sanitize(safeDesc)
); );
// 7. Respond success // 7. Respond success