Fix: 0 length upload should be allowed

pull/247/head
HFO4 5 years ago
parent 671d031d00
commit a994a74f4e

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

@ -73,7 +73,6 @@ func TestFileSystem_ValidateFileSize(t *testing.T) {
asserts.True(fs.ValidateFileSize(ctx, 5))
asserts.True(fs.ValidateFileSize(ctx, 10))
asserts.False(fs.ValidateFileSize(ctx, 11))
asserts.False(fs.ValidateFileSize(ctx, 0))
}
func TestFileSystem_ValidateExtension(t *testing.T) {

Loading…
Cancel
Save