Skip to content

Commit

Permalink
refactor: 文件名禁用"`'$符号
Browse files Browse the repository at this point in the history
  • Loading branch information
allape committed Dec 5, 2021
1 parent 615cd65 commit 7beaed1
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,17 @@ class FileNameValidator(
errorText = "$objectName name can NOT be empty"
return false
}
if (value == inputString) {
errorText = "$value already exists"
return false
}
val parsedName = inputString.replace("\\", ExplorerBaseWindow.FILE_SEP)
if (!isDirectory && inputString.endsWith(ExplorerBaseWindow.FILE_SEP)) {
errorText = "$objectName name can NOT end withs ${ExplorerBaseWindow.FILE_SEP}"
return false
}
if (value == inputString) {
errorText = "$value already exists"
if (inputString.contains(Regex("[\"'`\$]"))) {
errorText = "$objectName name can NOT contain [\"'`$]"
return false
}
val tokenizer = StringTokenizer(
Expand Down

0 comments on commit 7beaed1

Please sign in to comment.