fix: mapping filename in GetName
some missed filename mapping
This commit is contained in:
@ -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 {
|
||||
|
@ -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() == "" {
|
||||
|
@ -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(),
|
||||
})
|
||||
|
Reference in New Issue
Block a user