Fix: able to upload empty file

This commit is contained in:
HFO4
2019-11-23 15:37:13 +08:00
parent 948059ec1c
commit 671d031d00
6 changed files with 45 additions and 4 deletions

View File

@@ -28,12 +28,18 @@ func (fs *FileSystem) ValidateLegalName(ctx context.Context, name string) bool {
if len(name) >= 256 {
return false
}
// 是否为空限制
if len(name) == 0 {
return false
}
return true
}
// ValidateFileSize 验证上传的文件大小是否超出限制
func (fs *FileSystem) ValidateFileSize(ctx context.Context, size uint64) bool {
return size <= fs.User.Policy.MaxSize
return size <= fs.User.Policy.MaxSize && size != 0
}
// ValidateCapacity 验证并扣除用户容量