Skip to content

Commit 7beaed1

Browse files
committed
refactor: 文件名禁用"`'$符号
1 parent 615cd65 commit 7beaed1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/kotlin/net/allape/component/FileNameTextFieldDialog.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,17 @@ class FileNameValidator(
6262
errorText = "$objectName name can NOT be empty"
6363
return false
6464
}
65+
if (value == inputString) {
66+
errorText = "$value already exists"
67+
return false
68+
}
6569
val parsedName = inputString.replace("\\", ExplorerBaseWindow.FILE_SEP)
6670
if (!isDirectory && inputString.endsWith(ExplorerBaseWindow.FILE_SEP)) {
6771
errorText = "$objectName name can NOT end withs ${ExplorerBaseWindow.FILE_SEP}"
6872
return false
6973
}
70-
if (value == inputString) {
71-
errorText = "$value already exists"
74+
if (inputString.contains(Regex("[\"'`\$]"))) {
75+
errorText = "$objectName name can NOT contain [\"'`$]"
7276
return false
7377
}
7478
val tokenizer = StringTokenizer(

0 commit comments

Comments
 (0)