From de324a23be1e1dd06595763a295d2577daea0cb1 Mon Sep 17 00:00:00 2001 From: EoD <293499+EoD@users.noreply.github.com> Date: Thu, 10 Jul 2025 21:14:50 +0000 Subject: [PATCH] fix string to map generation with base64 encoding The new base64 encoding uses "=" characters as part of its encoding. The previous code split those and trimmed them afterwards, making the base64 not consistent with the rest of the code that assumed "=" are still present, like "B64:e30=". --- .../fubuki/playersync/util/LocalJsonUtil.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/main/java/vip/fubuki/playersync/util/LocalJsonUtil.java b/src/main/java/vip/fubuki/playersync/util/LocalJsonUtil.java index f82748d..e3423e4 100644 --- a/src/main/java/vip/fubuki/playersync/util/LocalJsonUtil.java +++ b/src/main/java/vip/fubuki/playersync/util/LocalJsonUtil.java @@ -11,8 +11,15 @@ public class LocalJsonUtil { String[] split = s2.split(","); for (int i = split.length - 1; i >= 0; i--) { String trim = split[i].trim(); - String[] split1 = trim.split("="); - map.put(split1[0],split1[1]); + + // only check for the first "=" as the values also contain additional "=" + int equalIndex = trim.indexOf('='); + if (equalIndex < 0) + continue; + + String key = trim.substring(0, equalIndex); + String value = trim.substring(equalIndex + 1); + map.put(key, value); } return map; } @@ -24,8 +31,15 @@ public class LocalJsonUtil { String[] split = s2.split(","); for (int i = split.length - 1; i >= 0; i--) { String trim = split[i].trim(); - String[] split1 = trim.split("="); - map.put(Integer.parseInt(split1[0]),split1[1]); + + // only check for the first "=" as the values also contain additional "=" + int equalIndex = trim.indexOf('='); + if (equalIndex < 0) + continue; + + String key = trim.substring(0, equalIndex); + String value = trim.substring(equalIndex + 1); + map.put(Integer.parseInt(key), value); } return map; }