Skip to content

Commit

Permalink
Do not slugify manual slugs
Browse files Browse the repository at this point in the history
We have accidentally been slugifying manually defined slugs, so only
slugify if slug is already null

Signed-off-by: BT (calcastor/mame) <43831917+calcastor@users.noreply.github.com>
  • Loading branch information
calcastor committed Mar 9, 2024
1 parent 2708649 commit ff802a3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/tc/oc/pgm/map/MapInfoImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ public VariantData(Element root, @Nullable Element variantEl) throws InvalidXMLE
this.world = variantEl.getAttributeValue("world");
if (slug != null) slug += "_" + variantId;
}
this.mapId = assertNotNull(StringUtils.slugify(slug != null ? slug : mapName));
this.mapId = assertNotNull(slug != null ? slug : StringUtils.slugify(mapName));
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion util/src/main/java/tc/oc/pgm/util/StringUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public static String normalize(String text) {
return text == null
? ""
: Normalizer.normalize(text, Normalizer.Form.NFD)
.replaceAll("[^A-Za-z0-9 ]", "")
.replaceAll("[^A-Za-z0-9_ ]", "")
.toLowerCase(Locale.ROOT);
}

Expand Down

0 comments on commit ff802a3

Please sign in to comment.