mirror of
https://github.com/chrislusf/seaweedfs
synced 2024-06-28 13:23:03 +02:00
avoid non utf-8 in filename
fix https://github.com/chrislusf/seaweedfs/issues/1493
This commit is contained in:
parent
d9545d4d6b
commit
a37535cd9f
|
@ -13,6 +13,7 @@ func NewFullPath(dir, name string) FullPath {
|
||||||
|
|
||||||
func (fp FullPath) DirAndName() (string, string) {
|
func (fp FullPath) DirAndName() (string, string) {
|
||||||
dir, name := filepath.Split(string(fp))
|
dir, name := filepath.Split(string(fp))
|
||||||
|
name = strings.ToValidUTF8(name, "?")
|
||||||
if dir == "/" {
|
if dir == "/" {
|
||||||
return dir, name
|
return dir, name
|
||||||
}
|
}
|
||||||
|
@ -24,6 +25,7 @@ func (fp FullPath) DirAndName() (string, string) {
|
||||||
|
|
||||||
func (fp FullPath) Name() string {
|
func (fp FullPath) Name() string {
|
||||||
_, name := filepath.Split(string(fp))
|
_, name := filepath.Split(string(fp))
|
||||||
|
name = strings.ToValidUTF8(name, "?")
|
||||||
return name
|
return name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue