fix(webdav): virtual path no account

pull/884/head
Xhofe 2022-04-01 21:57:55 +08:00
parent df90311453
commit 0537449335
1 changed files with 12 additions and 10 deletions

View File

@ -31,19 +31,21 @@ func (fs *FileSystem) File(rawPath string) (*model.File, error) {
if f, ok := upFileMap[rawPath]; ok {
return f, nil
}
if model.AccountsCount() > 1 && rawPath == "/" {
now := time.Now()
return &model.File{
Name: "root",
Size: 0,
Type: conf.FOLDER,
Driver: "root",
UpdatedAt: &now,
}, nil
}
account, path_, driver, err := common.ParsePath(rawPath)
log.Debugln(account, path_, driver, err)
if err != nil {
if err.Error() == "path not found" {
accountFiles := model.GetAccountFilesByPath(rawPath)
if len(accountFiles) != 0 {
now := time.Now()
return &model.File{
Name: "root",
Size: 0,
Type: conf.FOLDER,
UpdatedAt: &now,
}, nil
}
}
return nil, err
}
return operate.File(driver, account, path_)