]> Sergey Matveev's repositories - btrtrc.git/blobdiff - storage/file.go
fix: can not download invalid utf8 name with BestName and BestPath (#915)
[btrtrc.git] / storage / file.go
index 231825fdfeed38f9dfeb1229542c8fde31942bde..d15e579d7e7d92aceb901165180313b46cddeb95 100644 (file)
@@ -39,10 +39,10 @@ func NewFileOpts(opts NewFileClientOpts) ClientImplCloser {
        if opts.FilePathMaker == nil {
                opts.FilePathMaker = func(opts FilePathMakerOpts) string {
                        var parts []string
-                       if opts.Info.Name != metainfo.NoName {
-                               parts = append(parts, opts.Info.Name)
+                       if opts.Info.BestName() != metainfo.NoName {
+                               parts = append(parts, opts.Info.BestName())
                        }
-                       return filepath.Join(append(parts, opts.File.Path...)...)
+                       return filepath.Join(append(parts, opts.File.BestPath()...)...)
                }
        }
        if opts.PieceCompletion == nil {