From 00fe1adf2ef65059215c6a7113b3a3d17abf563c Mon Sep 17 00:00:00 2001 From: Lilly Rose Berner Date: Mon, 22 Apr 2024 21:54:09 +0200 Subject: [PATCH] Fix user agent stripping not working (#707) - Fix Mod Menu build metadata not being properly stripped from the User Agent string generation for privacy --- .../com/terraformersmc/modmenu/util/UpdateCheckerUtil.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/terraformersmc/modmenu/util/UpdateCheckerUtil.java b/src/main/java/com/terraformersmc/modmenu/util/UpdateCheckerUtil.java index ce4ef7ce..f08a575e 100644 --- a/src/main/java/com/terraformersmc/modmenu/util/UpdateCheckerUtil.java +++ b/src/main/java/com/terraformersmc/modmenu/util/UpdateCheckerUtil.java @@ -82,9 +82,9 @@ public static void checkForModrinthUpdates() { List loaders = ModMenu.runningQuilt ? List.of("fabric", "quilt") : List.of("fabric"); String mcVer = SharedConstants.getGameVersion().getName(); - String[] splitVersion = FabricLoader.getInstance().getModContainer(ModMenu.MOD_ID) - .get().getMetadata().getVersion().getFriendlyString().split("\\+", 1); // Strip build metadata for privacy - final var modMenuVersion = splitVersion.length > 1 ? splitVersion[1] : splitVersion[0]; + String version = FabricLoader.getInstance().getModContainer(ModMenu.MOD_ID) + .get().getMetadata().getVersion().getFriendlyString(); + final var modMenuVersion = version.split("\\+", 2)[0]; // Strip build metadata for privacy final var userAgent = "%s/%s (%s/%s%s)".formatted(ModMenu.GITHUB_REF, modMenuVersion, mcVer, primaryLoader, environment); List updateChannels;