forked from TrueCloudLab/rclone
jottacloud: fix listing output of remote with special characters
This fixes the failing integration test: TestIntegration/FsMkdir/FsPutFiles/FsIsFile
This commit is contained in:
parent
edf0412464
commit
a9d3283d97
1 changed files with 7 additions and 7 deletions
|
@ -932,7 +932,7 @@ func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err e
|
||||||
return entries, nil
|
return entries, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseListRStream(ctx context.Context, r io.Reader, trimPrefix string, filesystem *Fs, callback func(fs.DirEntry) error) error {
|
func parseListRStream(ctx context.Context, r io.Reader, filesystem *Fs, callback func(fs.DirEntry) error) error {
|
||||||
|
|
||||||
type stats struct {
|
type stats struct {
|
||||||
Folders int `xml:"folders"`
|
Folders int `xml:"folders"`
|
||||||
|
@ -968,8 +968,12 @@ func parseListRStream(ctx context.Context, r io.Reader, trimPrefix string, files
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// liststream paths are /mountpoint/root/path
|
||||||
|
// so the returned paths should have /mountpoint/root/ trimmed
|
||||||
|
// as the caller is expecting path.
|
||||||
|
pathPrefix := filesystem.opt.Enc.FromStandardPath(path.Join("/", filesystem.opt.Mountpoint, filesystem.root))
|
||||||
trimPathPrefix := func(p string) string {
|
trimPathPrefix := func(p string) string {
|
||||||
p = strings.TrimPrefix(p, trimPrefix)
|
p = strings.TrimPrefix(p, pathPrefix)
|
||||||
p = strings.TrimPrefix(p, "/")
|
p = strings.TrimPrefix(p, "/")
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
@ -1052,11 +1056,7 @@ func (f *Fs) ListR(ctx context.Context, dir string, callback fs.ListRCallback) (
|
||||||
return shouldRetry(ctx, resp, err)
|
return shouldRetry(ctx, resp, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// liststream paths are /mountpoint/root/path
|
err = parseListRStream(ctx, resp.Body, f, func(d fs.DirEntry) error {
|
||||||
// so the returned paths should have /mountpoint/root/ trimmed
|
|
||||||
// as the caller is expecting path.
|
|
||||||
trimPrefix := path.Join("/", f.opt.Mountpoint, f.root)
|
|
||||||
err = parseListRStream(ctx, resp.Body, trimPrefix, f, func(d fs.DirEntry) error {
|
|
||||||
if d.Remote() == dir {
|
if d.Remote() == dir {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue