feat: custom filename char mapping

fixes #2447 #2446 #2440 #2409 #2006 #1979 #1507 #324 #691 #518 #430
This commit is contained in:
Noah Hsu
2022-11-22 15:54:18 +08:00
parent 25fd343069
commit c09800790b
10 changed files with 43 additions and 18 deletions

View File

@ -10,9 +10,11 @@ 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
@ -99,7 +101,7 @@ func walkFS(ctx context.Context, depth int, name string, info model.Obj, walkFn
}
for _, fileInfo := range objs {
filename := path.Join(name, fileInfo.GetName())
filename := path.Join(name, utils.MappingName(fileInfo.GetName(), conf.FilenameCharMap))
if err != nil {
if err := walkFn(filename, fileInfo, err); err != nil && err != filepath.SkipDir {
return err