fix: local relative path
This commit is contained in:
@ -2,6 +2,7 @@ package data
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/alist-org/alist/v3/internal/db"
|
||||
"github.com/alist-org/alist/v3/internal/model"
|
||||
"github.com/alist-org/alist/v3/internal/operations"
|
||||
log "github.com/sirupsen/logrus"
|
||||
@ -18,4 +19,17 @@ func initDevData() {
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create account: %+v", err)
|
||||
}
|
||||
err = db.CreateUser(&model.User{
|
||||
Username: "Noah",
|
||||
Password: "hsu",
|
||||
BasePath: "/data",
|
||||
ReadOnly: false,
|
||||
Webdav: false,
|
||||
Role: 0,
|
||||
IgnoreHide: false,
|
||||
IgnorePassword: false,
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create user: %+v", err)
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import (
|
||||
)
|
||||
|
||||
// List files
|
||||
// TODO: sort
|
||||
func list(ctx context.Context, path string) ([]model.Obj, error) {
|
||||
meta := ctx.Value("meta").(*model.Meta)
|
||||
user := ctx.Value("user").(*model.User)
|
||||
|
@ -87,7 +87,7 @@ func Get(ctx context.Context, account driver.Driver, path string) (model.Obj, er
|
||||
}
|
||||
// not root folder
|
||||
dir, name := stdpath.Split(path)
|
||||
files, err := List(ctx, account, dir)
|
||||
files, err := List(ctx, account, utils.StandardizePath(dir))
|
||||
if err != nil {
|
||||
return nil, errors.WithMessage(err, "failed get parent list")
|
||||
}
|
||||
|
Reference in New Issue
Block a user