mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2025-11-25 19:37:41 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
342729179d | ||
|
|
0537449335 | ||
|
|
df90311453 |
@@ -38,10 +38,10 @@ func ParsePath(rawPath string) (*model.Account, string, base.Driver, error) {
|
|||||||
if bIndex != -1 {
|
if bIndex != -1 {
|
||||||
name = name[:bIndex]
|
name = name[:bIndex]
|
||||||
}
|
}
|
||||||
if name == "/" {
|
//if name == "/" {
|
||||||
name = ""
|
// name = ""
|
||||||
}
|
//}
|
||||||
return &account, strings.TrimPrefix(rawPath, name), driver, nil
|
return &account, utils.ParsePath(strings.TrimPrefix(rawPath, name)), driver, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func ErrorResp(c *gin.Context, err error, code int) {
|
func ErrorResp(c *gin.Context, err error, code int) {
|
||||||
|
|||||||
@@ -31,18 +31,21 @@ func (fs *FileSystem) File(rawPath string) (*model.File, error) {
|
|||||||
if f, ok := upFileMap[rawPath]; ok {
|
if f, ok := upFileMap[rawPath]; ok {
|
||||||
return f, nil
|
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)
|
account, path_, driver, err := common.ParsePath(rawPath)
|
||||||
|
log.Debugln(account, path_, driver, err)
|
||||||
if err != nil {
|
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 nil, err
|
||||||
}
|
}
|
||||||
return operate.File(driver, account, path_)
|
return operate.File(driver, account, path_)
|
||||||
|
|||||||
Reference in New Issue
Block a user