diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/LocalModpackPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/LocalModpackPage.java index 871c42641..1793c4c33 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/LocalModpackPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/LocalModpackPage.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher - * Copyright (C) 2020 huangyuhui and contributors + * Copyright (C) 2021 huangyuhui and contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -131,7 +131,8 @@ public final class LocalModpackPage extends StackPane implements WizardPage { lblModpackLocation.setText(selectedFile.getAbsolutePath()); if (!name.isPresent()) { - txtModpackName.setText(manifest.getName()); + // trim: https://github.com/huanghongxun/HMCL/issues/962 + txtModpackName.setText(manifest.getName().trim()); } }, e -> { Controllers.dialog(i18n("modpack.task.install.error"), i18n("message.error"), MessageType.ERROR); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/RemoteModpackPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/RemoteModpackPage.java index ed8e224fb..fc5fe659c 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/RemoteModpackPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/RemoteModpackPage.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher - * Copyright (C) 2020 huangyuhui and contributors + * Copyright (C) 2021 huangyuhui and contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -101,7 +101,8 @@ public class RemoteModpackPage extends StackPane implements WizardPage { lblAuthor.setText(manifest.getAuthor()); if (!name.isPresent()) { - txtModpackName.setText(manifest.getName()); + // trim: https://github.com/huanghongxun/HMCL/issues/962 + txtModpackName.setText(manifest.getName().trim()); txtModpackName.getValidators().addAll( new Validator(i18n("install.new_game.already_exists"), str -> !profile.getRepository().hasVersion(str) && StringUtils.isNotBlank(str)), new Validator(i18n("version.forbidden_name"), str -> !profile.getRepository().forbidsVersion(str))