Fix: endless loop while creating nested folders

pull/247/head
HFO4 5 years ago
parent 4420a75c04
commit 58d8695c53

@ -344,7 +344,7 @@ func (fs *FileSystem) listObjects(ctx context.Context, parent string, files []mo
// CreateDirectory 根据给定的完整创建目录,支持递归创建 // CreateDirectory 根据给定的完整创建目录,支持递归创建
func (fs *FileSystem) CreateDirectory(ctx context.Context, fullPath string) (*model.Folder, error) { func (fs *FileSystem) CreateDirectory(ctx context.Context, fullPath string) (*model.Folder, error) {
if fullPath == "/" { if fullPath == "/" || fullPath == "." || fullPath == "" {
return nil, ErrRootProtected return nil, ErrRootProtected
} }

@ -87,6 +87,7 @@ func TestLocalFileUpload(t *testing.T) {
) )
req.Header.Add("Content-Length", "4") req.Header.Add("Content-Length", "4")
req.Header.Add("X-FileName", "TestFileUploadRoute.txt") req.Header.Add("X-FileName", "TestFileUploadRoute.txt")
req.Header.Add("X-Path", "/")
return req return req
}, },
ExpectCode: 0, ExpectCode: 0,

Loading…
Cancel
Save