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=".
This commit is contained in:
EoD 2025-07-10 21:14:50 +00:00
parent a382b0105a
commit de324a23be

View File

@ -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;
}