Fix: directory renaming should not be limited by file extensions (#395)

This commit is contained in:
HFO4
2020-05-19 11:25:01 +08:00
parent 4c458df666
commit 5af3c4e244
3 changed files with 31 additions and 2 deletions

View File

@@ -32,7 +32,7 @@ type Object struct {
// Rename 重命名对象
func (fs *FileSystem) Rename(ctx context.Context, dir, file []uint, new string) (err error) {
// 验证新名字
if !fs.ValidateLegalName(ctx, new) || !fs.ValidateExtension(ctx, new) {
if !fs.ValidateLegalName(ctx, new) || (len(file) > 0 && !fs.ValidateExtension(ctx, new)) {
return ErrIllegalObjectName
}