fix: mapping filename in GetName

some missed filename mapping
This commit is contained in:
Noah Hsu
2022-11-30 20:46:54 +08:00
parent d94cf72da2
commit 83644dab85
11 changed files with 33 additions and 25 deletions

View File

@ -1,6 +1,10 @@
package model
import "time"
import (
"time"
"github.com/alist-org/alist/v3/pkg/utils"
)
type Object struct {
ID string
@ -12,7 +16,7 @@ type Object struct {
}
func (o *Object) GetName() string {
return o.Name
return utils.MappingName(o.Name)
}
func (o *Object) GetSize() int64 {

View File

@ -8,7 +8,6 @@ import (
"time"
"github.com/Xhofe/go-cache"
"github.com/alist-org/alist/v3/internal/conf"
"github.com/alist-org/alist/v3/internal/driver"
"github.com/alist-org/alist/v3/internal/errs"
"github.com/alist-org/alist/v3/internal/model"
@ -129,7 +128,7 @@ func Get(ctx context.Context, storage driver.Driver, path string) (model.Obj, er
}
for _, f := range files {
// TODO maybe copy obj here
if utils.MappingName(f.GetName(), conf.FilenameCharMap) == name {
if f.GetName() == name {
// use path as id, why don't set id in List function?
// because files maybe cache, set id here can reduce memory usage
if f.GetPath() == "" {

View File

@ -9,7 +9,6 @@ import (
"github.com/alist-org/alist/v3/internal/errs"
"github.com/alist-org/alist/v3/internal/model"
"github.com/alist-org/alist/v3/internal/search/searcher"
"github.com/alist-org/alist/v3/pkg/utils"
log "github.com/sirupsen/logrus"
)
@ -54,7 +53,7 @@ func Index(ctx context.Context, parent string, obj model.Obj) error {
}
return instance.Index(ctx, model.SearchNode{
Parent: parent,
Name: utils.MappingName(obj.GetName(), conf.FilenameCharMap),
Name: obj.GetName(),
IsDir: obj.IsDir(),
Size: obj.GetSize(),
})