Fix: able to upload empty file
This commit is contained in:
@@ -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 验证并扣除用户容量
|
||||
|
||||
Reference in New Issue
Block a user