diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-09-26 00:13:39 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-09-26 00:13:39 -0700 |
| commit | a37535cd9fe4dc739aa4beda51878c5e22ecbdf8 (patch) | |
| tree | e0308cce1e7627c00653fa30ca30705cb2795ca8 | |
| parent | d9545d4d6b4f53ae308647baab8b97f1c3b30714 (diff) | |
| download | seaweedfs-a37535cd9fe4dc739aa4beda51878c5e22ecbdf8.tar.xz seaweedfs-a37535cd9fe4dc739aa4beda51878c5e22ecbdf8.zip | |
avoid non utf-8 in filename
fix https://github.com/chrislusf/seaweedfs/issues/1493
| -rw-r--r-- | weed/util/fullpath.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/weed/util/fullpath.go b/weed/util/fullpath.go index 4ce8a2f90..f2119707e 100644 --- a/weed/util/fullpath.go +++ b/weed/util/fullpath.go @@ -13,6 +13,7 @@ func NewFullPath(dir, name string) FullPath { func (fp FullPath) DirAndName() (string, string) { dir, name := filepath.Split(string(fp)) + name = strings.ToValidUTF8(name, "?") if dir == "/" { return dir, name } @@ -24,6 +25,7 @@ func (fp FullPath) DirAndName() (string, string) { func (fp FullPath) Name() string { _, name := filepath.Split(string(fp)) + name = strings.ToValidUTF8(name, "?") return name } |
