Feat: after uploading hooks and checks

This commit is contained in:
HFO4
2019-11-18 19:09:56 +08:00
parent 0dddc12609
commit aa17aa8e6a
10 changed files with 105 additions and 16 deletions

View File

@@ -12,11 +12,17 @@ var reservedCharacter = []string{"\\", "?", "*", "<", "\"", ":", ">", "/"}
// ValidateLegalName 验证文件名/文件夹名是否合法
func (fs *FileSystem) ValidateLegalName(ctx context.Context, name string) bool {
// 是否包含保留字符
for _, value := range reservedCharacter {
if strings.Contains(name, value) {
return false
}
}
// 是否超出长度限制
if len(name) >= 256 {
return false
}
return true
}