webdav: fix interop with davrods server

The davrods server returns URLS with a double / in and the // confuses
rclone into thinking these files are in a directory called "".

The fix removes leading /s from the directory listing names.

See: https://forum.rclone.org/t/upload-to-webdav-does-not-check-if-files-already-exist/35756/
This commit is contained in:
Nick Craig-Wood 2023-01-31 12:07:21 +00:00
parent ac20ee41ca
commit 21849fd0d9

View File

@ -712,6 +712,7 @@ func (f *Fs) listAll(ctx context.Context, dir string, directoriesOnly bool, file
continue continue
} }
subPath := u.Path[len(baseURL.Path):] subPath := u.Path[len(baseURL.Path):]
subPath = strings.TrimPrefix(subPath, "/") // ignore leading / here for davrods
if f.opt.Enc != encoder.EncodeZero { if f.opt.Enc != encoder.EncodeZero {
subPath = f.opt.Enc.ToStandardPath(subPath) subPath = f.opt.Enc.ToStandardPath(subPath)
} }