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

@ -6,7 +6,6 @@ import (
"strings"
"time"
"github.com/alist-org/alist/v3/internal/conf"
"github.com/alist-org/alist/v3/internal/db"
"github.com/alist-org/alist/v3/internal/errs"
"github.com/alist-org/alist/v3/internal/fs"
@ -140,7 +139,7 @@ func filterDirs(objs []model.Obj) []DirResp {
for _, obj := range objs {
if obj.IsDir() {
dirs = append(dirs, DirResp{
Name: utils.MappingName(obj.GetName(), conf.FilenameCharMap),
Name: obj.GetName(),
Modified: obj.ModTime(),
})
}
@ -187,7 +186,7 @@ func toObjsResp(objs []model.Obj, parent string, encrypt bool) []ObjResp {
thumb = t.Thumb()
}
resp = append(resp, ObjResp{
Name: utils.MappingName(obj.GetName(), conf.FilenameCharMap),
Name: obj.GetName(),
Size: obj.GetSize(),
IsDir: obj.IsDir(),
Modified: obj.ModTime(),
@ -285,7 +284,7 @@ func FsGet(c *gin.Context) {
parentMeta, _ := db.GetNearestMeta(parentPath)
common.SuccessResp(c, FsGetResp{
ObjResp: ObjResp{
Name: utils.MappingName(obj.GetName(), conf.FilenameCharMap),
Name: obj.GetName(),
Size: obj.GetSize(),
IsDir: obj.IsDir(),
Modified: obj.ModTime(),

View File

@ -10,11 +10,9 @@ import (
"path"
"path/filepath"
"github.com/alist-org/alist/v3/internal/conf"
"github.com/alist-org/alist/v3/internal/db"
"github.com/alist-org/alist/v3/internal/fs"
"github.com/alist-org/alist/v3/internal/model"
"github.com/alist-org/alist/v3/pkg/utils"
)
// slashClean is equivalent to but slightly more efficient than
@ -101,7 +99,7 @@ func walkFS(ctx context.Context, depth int, name string, info model.Obj, walkFn
}
for _, fileInfo := range objs {
filename := path.Join(name, utils.MappingName(fileInfo.GetName(), conf.FilenameCharMap))
filename := path.Join(name, fileInfo.GetName())
if err != nil {
if err := walkFn(filename, fileInfo, err); err != nil && err != filepath.SkipDir {
return err

View File

@ -15,9 +15,7 @@ import (
"path"
"strconv"
"github.com/alist-org/alist/v3/internal/conf"
"github.com/alist-org/alist/v3/internal/model"
"github.com/alist-org/alist/v3/pkg/utils"
)
// Proppatch describes a property update instruction as defined in RFC 4918.
@ -199,7 +197,7 @@ func props(ctx context.Context, ls LockSystem, fi model.Obj, pnames []xml.Name)
}
// Otherwise, it must either be a live property or we don't know it.
if prop := liveProps[pn]; prop.findFn != nil && (prop.dir || !isDir) {
innerXML, err := prop.findFn(ctx, ls, utils.MappingName(fi.GetName(), conf.FilenameCharMap), fi)
innerXML, err := prop.findFn(ctx, ls, fi.GetName(), fi)
if err != nil {
return nil, err
}
@ -375,7 +373,7 @@ func findDisplayName(ctx context.Context, ls LockSystem, name string, fi model.O
// Hide the real name of a possibly prefixed root directory.
return "", nil
}
return escapeXML(utils.MappingName(fi.GetName(), conf.FilenameCharMap)), nil
return escapeXML(fi.GetName()), nil
}
func findContentLength(ctx context.Context, ls LockSystem, name string, fi model.Obj) (string, error) {