fix: make getShortId return first chunk if a separator is present

and the chunk is <= 8 characters long
This commit is contained in:
thecockatiel 2025-01-05 13:47:51 +03:30
parent f079e26e09
commit e242ae4a4e
No known key found for this signature in database
GPG key ID: 3E5CDC091FAF3BBA

View file

@ -485,7 +485,7 @@ public class Utilities {
@SuppressWarnings("SameParameterValue") @SuppressWarnings("SameParameterValue")
public static String getShortId(String id, String sep) { public static String getShortId(String id, String sep) {
String[] chunks = id.split(sep); String[] chunks = id.split(sep);
if (chunks.length > 0) if (chunks.length > 1 && chunks[0].length() <= 8)
return chunks[0]; return chunks[0];
else else
return id.substring(0, Math.min(8, id.length())); return id.substring(0, Math.min(8, id.length()));