From 8b0d9e5a5c3687a8ca449d4a6694984793f1d4e7 Mon Sep 17 00:00:00 2001 From: SALTWOOD <105980161+SALTWOOD@users.noreply.github.com> Date: Thu, 15 Aug 2024 17:12:27 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix:=20=E6=9A=82=E6=97=B6=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E6=B3=A2=E6=B5=AA=E5=8F=B7=E6=A3=80=E6=B5=8B=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=20#4505?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Plain Craft Launcher 2/Modules/Base/ModValidate.vb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Plain Craft Launcher 2/Modules/Base/ModValidate.vb b/Plain Craft Launcher 2/Modules/Base/ModValidate.vb index b7f818b4..eedc20ee 100644 --- a/Plain Craft Launcher 2/Modules/Base/ModValidate.vb +++ b/Plain Craft Launcher 2/Modules/Base/ModValidate.vb @@ -214,6 +214,7 @@ Public Class ValidateFolderName On Error Resume Next PathIgnore = New DirectoryInfo(Path).EnumerateDirectories End Sub + Public Overrides Function Validate(Str As String) As String Try '检查是否为空 @@ -233,6 +234,8 @@ Public Class ValidateFolderName '检查特殊字符串 Dim InvalidStrCheck As String = New ValidateExceptSame({"CON", "PRN", "AUX", "CLOCK$", "NUL", "COM0", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT0", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9"}, "文件夹名不可为 %!", True).Validate(Str) If Not InvalidStrCheck = "" Then Return InvalidStrCheck + '检查波浪号 (issue #4505) + If Str.Contains("~") Then Return "文件名不能包含波浪号!" '检查文件夹重名 Dim Arr As New List(Of String) If PathIgnore IsNot Nothing Then @@ -286,6 +289,8 @@ Public Class ValidateFileName '检查特殊字符串 Dim InvalidStrCheck As String = New ValidateExceptSame({"CON", "PRN", "AUX", "CLOCK$", "NUL", "COM0", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT0", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9"}, "文件名不可为 %!", True).Validate(Str) If Not InvalidStrCheck = "" Then Return InvalidStrCheck + '检查波浪号 (issue #4505) + If Str.Contains("~") Then Return "文件名不能包含波浪号!" '检查文件重名 If ParentFolder IsNot Nothing Then Dim DirInfo As New DirectoryInfo(ParentFolder) @@ -351,7 +356,9 @@ Fin: '检查特殊字符串 Dim InvalidStrCheck As String = New ValidateExceptSame({"CON", "PRN", "AUX", "CLOCK$", "NUL", "COM0", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT0", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9"}, "文件夹名不可为 %!").Validate(SubStr) If Not InvalidStrCheck = "" Then Return InvalidStrCheck + '检查波浪号 (issue #4505) + If Str.Contains("~") Then Return "文件夹名不能包含波浪号!" Next Return "" End Function -End Class +End Class \ No newline at end of file From 3af99aca0a27e1a5e19b78c0a99af21269a03bb6 Mon Sep 17 00:00:00 2001 From: SALTWOOD <105980161+SALTWOOD@users.noreply.github.com> Date: Thu, 15 Aug 2024 17:24:42 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix:=20=E5=B0=91=E4=BA=86=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Plain Craft Launcher 2/Modules/Base/ModValidate.vb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Plain Craft Launcher 2/Modules/Base/ModValidate.vb b/Plain Craft Launcher 2/Modules/Base/ModValidate.vb index eedc20ee..9c9e51f3 100644 --- a/Plain Craft Launcher 2/Modules/Base/ModValidate.vb +++ b/Plain Craft Launcher 2/Modules/Base/ModValidate.vb @@ -214,7 +214,6 @@ Public Class ValidateFolderName On Error Resume Next PathIgnore = New DirectoryInfo(Path).EnumerateDirectories End Sub - Public Overrides Function Validate(Str As String) As String Try '检查是否为空 @@ -235,7 +234,7 @@ Public Class ValidateFolderName Dim InvalidStrCheck As String = New ValidateExceptSame({"CON", "PRN", "AUX", "CLOCK$", "NUL", "COM0", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT0", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9"}, "文件夹名不可为 %!", True).Validate(Str) If Not InvalidStrCheck = "" Then Return InvalidStrCheck '检查波浪号 (issue #4505) - If Str.Contains("~") Then Return "文件名不能包含波浪号!" + If Str.Contains("~") Then Return "文件夹名不能包含波浪号!" '检查文件夹重名 Dim Arr As New List(Of String) If PathIgnore IsNot Nothing Then From 2427fb76199ec42eb9e1c111855e65cdecde47b3 Mon Sep 17 00:00:00 2001 From: SALTWOOD <105980161+SALTWOOD@users.noreply.github.com> Date: Fri, 16 Aug 2024 11:38:09 +0800 Subject: [PATCH 3/4] =?UTF-8?q?refactor:=20=E4=BD=BF=E7=94=A8=E6=AD=A3?= =?UTF-8?q?=E5=88=99=E8=A1=A8=E8=BE=BE=E5=BC=8F=E6=A3=80=E6=B5=8B=20NTFS?= =?UTF-8?q?=208.3=20=E6=96=87=E4=BB=B6=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Plain Craft Launcher 2/Modules/Base/ModBase.vb | 10 ++++++++++ Plain Craft Launcher 2/Modules/Base/ModValidate.vb | 12 ++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Plain Craft Launcher 2/Modules/Base/ModBase.vb b/Plain Craft Launcher 2/Modules/Base/ModBase.vb index e7897f43..f7c7f420 100644 --- a/Plain Craft Launcher 2/Modules/Base/ModBase.vb +++ b/Plain Craft Launcher 2/Modules/Base/ModBase.vb @@ -1724,6 +1724,16 @@ RetryDir: Public Function RegexReplaceEach(Input As String, Replacement As MatchEvaluator, Regex As String, Optional options As RegexOptions = RegularExpressions.RegexOptions.None) As String Return RegularExpressions.Regex.Replace(Input, Regex, Replacement, options) End Function + ''' + ''' 检查传入字符串会不会引发 Issue #4505 + ''' + Public Function Ntfs83NameCheck(name As String) As Boolean + Dim regex As New Regex("(.*)~(\d*)") + Dim namePart As Byte() = Encoding.UTF8.GetBytes(regex.Match(name).Groups(1).Value) + Dim numPart As Integer = regex.Match(name).Groups(2).Value.Length + + Return namePart.Length >= 6 AndAlso numPart = 1 + End Function #End Region diff --git a/Plain Craft Launcher 2/Modules/Base/ModValidate.vb b/Plain Craft Launcher 2/Modules/Base/ModValidate.vb index 9c9e51f3..0321004b 100644 --- a/Plain Craft Launcher 2/Modules/Base/ModValidate.vb +++ b/Plain Craft Launcher 2/Modules/Base/ModValidate.vb @@ -233,8 +233,8 @@ Public Class ValidateFolderName '检查特殊字符串 Dim InvalidStrCheck As String = New ValidateExceptSame({"CON", "PRN", "AUX", "CLOCK$", "NUL", "COM0", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT0", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9"}, "文件夹名不可为 %!", True).Validate(Str) If Not InvalidStrCheck = "" Then Return InvalidStrCheck - '检查波浪号 (issue #4505) - If Str.Contains("~") Then Return "文件夹名不能包含波浪号!" + '检查 NTFS 8.3 (issue #4505) + If Ntfs83NameCheck(Str) Then Return "文件夹名不能是一个有效的 NTFS 8.3 文件名!" '检查文件夹重名 Dim Arr As New List(Of String) If PathIgnore IsNot Nothing Then @@ -288,8 +288,8 @@ Public Class ValidateFileName '检查特殊字符串 Dim InvalidStrCheck As String = New ValidateExceptSame({"CON", "PRN", "AUX", "CLOCK$", "NUL", "COM0", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT0", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9"}, "文件名不可为 %!", True).Validate(Str) If Not InvalidStrCheck = "" Then Return InvalidStrCheck - '检查波浪号 (issue #4505) - If Str.Contains("~") Then Return "文件名不能包含波浪号!" + '检查 NTFS 8.3 (issue #4505) + If Ntfs83NameCheck(Str) Then Return "文件名不能是一个有效的 NTFS 8.3 文件名!" '检查文件重名 If ParentFolder IsNot Nothing Then Dim DirInfo As New DirectoryInfo(ParentFolder) @@ -355,8 +355,8 @@ Fin: '检查特殊字符串 Dim InvalidStrCheck As String = New ValidateExceptSame({"CON", "PRN", "AUX", "CLOCK$", "NUL", "COM0", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT0", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9"}, "文件夹名不可为 %!").Validate(SubStr) If Not InvalidStrCheck = "" Then Return InvalidStrCheck - '检查波浪号 (issue #4505) - If Str.Contains("~") Then Return "文件夹名不能包含波浪号!" + '检查 NTFS 8.3 (issue #4505) + If Ntfs83NameCheck(Str) Then Return "文件夹名不能是一个有效的 NTFS 8.3 文件名!" Next Return "" End Function From ac9011a3230a6ee63540588bdcc393336815ce79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BE=99=E8=85=BE=E7=8C=AB=E8=B7=83?= <1043137532@qq.com> Date: Sun, 13 Oct 2024 04:28:38 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/ISSUE_TEMPLATE/bug1.yml | 2 +- .github/ISSUE_TEMPLATE/bug2.yml | 2 +- .github/ISSUE_TEMPLATE/bug9.yml | 2 +- .github/ISSUE_TEMPLATE/ch.yml | 2 +- .github/ISSUE_TEMPLATE/feature.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug1.yml b/.github/ISSUE_TEMPLATE/bug1.yml index 6a1f6993..68cd2bae 100644 --- a/.github/ISSUE_TEMPLATE/bug1.yml +++ b/.github/ISSUE_TEMPLATE/bug1.yml @@ -1,6 +1,6 @@ name: "Minecraft 崩溃" description: "PCL 提示 “Minecraft 出现错误”,或游戏崩溃" -labels: [· Bug, 新反馈] +labels: [· Bug, 新提交] body: - type: checkboxes id: "yml-1" diff --git a/.github/ISSUE_TEMPLATE/bug2.yml b/.github/ISSUE_TEMPLATE/bug2.yml index b2db13b4..de636f07 100644 --- a/.github/ISSUE_TEMPLATE/bug2.yml +++ b/.github/ISSUE_TEMPLATE/bug2.yml @@ -1,6 +1,6 @@ name: "下载或登录时卡住或失败" description: "下载游戏、Mod 或整合包,或登录正版账号时出现问题" -labels: [· Bug, 新反馈] +labels: [· Bug, 新提交] body: - type: checkboxes id: "yml-1" diff --git a/.github/ISSUE_TEMPLATE/bug9.yml b/.github/ISSUE_TEMPLATE/bug9.yml index 124b0c7a..be20097d 100644 --- a/.github/ISSUE_TEMPLATE/bug9.yml +++ b/.github/ISSUE_TEMPLATE/bug9.yml @@ -1,6 +1,6 @@ name: "综合 Bug 反馈" description: "遇见了没有细分选项的其他 Bug" -labels: [· Bug, 新反馈] +labels: [· Bug, 新提交] body: - type: checkboxes id: "yml-1" diff --git a/.github/ISSUE_TEMPLATE/ch.yml b/.github/ISSUE_TEMPLATE/ch.yml index 77ed3fda..0ddd6930 100644 --- a/.github/ISSUE_TEMPLATE/ch.yml +++ b/.github/ISSUE_TEMPLATE/ch.yml @@ -1,6 +1,6 @@ name: "优化建议" description: "对已有功能的小幅度优化或改进建议" -labels: [· 优化, 新反馈] +labels: [· 优化, 新提交] body: - type: checkboxes id: "yml-1" diff --git a/.github/ISSUE_TEMPLATE/feature.yml b/.github/ISSUE_TEMPLATE/feature.yml index e799ee42..e27452b5 100644 --- a/.github/ISSUE_TEMPLATE/feature.yml +++ b/.github/ISSUE_TEMPLATE/feature.yml @@ -1,6 +1,6 @@ name: "新功能提案" description: "对已有功能的大幅度修改,或添加一个新内容或选项" -labels: [· 新功能, 新反馈] +labels: [· 新功能, 新提交] body: - type: checkboxes id: "yml-1"