fix: trim modpack name when installing new modpack, fix #962
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Hello Minecraft! Launcher
|
* Hello Minecraft! Launcher
|
||||||
* Copyright (C) 2020 huangyuhui <huanghongxun2008@126.com> and contributors
|
* Copyright (C) 2021 huangyuhui <huanghongxun2008@126.com> and contributors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* 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());
|
lblModpackLocation.setText(selectedFile.getAbsolutePath());
|
||||||
|
|
||||||
if (!name.isPresent()) {
|
if (!name.isPresent()) {
|
||||||
txtModpackName.setText(manifest.getName());
|
// trim: https://github.com/huanghongxun/HMCL/issues/962
|
||||||
|
txtModpackName.setText(manifest.getName().trim());
|
||||||
}
|
}
|
||||||
}, e -> {
|
}, e -> {
|
||||||
Controllers.dialog(i18n("modpack.task.install.error"), i18n("message.error"), MessageType.ERROR);
|
Controllers.dialog(i18n("modpack.task.install.error"), i18n("message.error"), MessageType.ERROR);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Hello Minecraft! Launcher
|
* Hello Minecraft! Launcher
|
||||||
* Copyright (C) 2020 huangyuhui <huanghongxun2008@126.com> and contributors
|
* Copyright (C) 2021 huangyuhui <huanghongxun2008@126.com> and contributors
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* 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());
|
lblAuthor.setText(manifest.getAuthor());
|
||||||
|
|
||||||
if (!name.isPresent()) {
|
if (!name.isPresent()) {
|
||||||
txtModpackName.setText(manifest.getName());
|
// trim: https://github.com/huanghongxun/HMCL/issues/962
|
||||||
|
txtModpackName.setText(manifest.getName().trim());
|
||||||
txtModpackName.getValidators().addAll(
|
txtModpackName.getValidators().addAll(
|
||||||
new Validator(i18n("install.new_game.already_exists"), str -> !profile.getRepository().hasVersion(str) && StringUtils.isNotBlank(str)),
|
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))
|
new Validator(i18n("version.forbidden_name"), str -> !profile.getRepository().forbidsVersion(str))
|
||||||
|
|||||||
Reference in New Issue
Block a user