Skip to content

Commit

Permalink
fix(webdav): virtual path no account
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Apr 1, 2022
1 parent df90311 commit 0537449
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions server/webdav/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -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_)
Expand Down

0 comments on commit 0537449

Please sign in to comment.