8000 webdav: ensure we call MKCOL with a URL with a trailing / #2350 · devdevmac/rclone@e7ae5e8 · GitHub
[go: up one dir, main page]

Skip to content

Commit e7ae5e8

Browse files
committed
webdav: ensure we call MKCOL with a URL with a trailing / rclone#2350
This is an attempt to fix rclone and qnap interop.
1 parent 56e1e82 commit e7ae5e8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

backend/webdav/webdav.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,11 @@ func (f *Fs) PutStream(in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption
542542
// mkParentDir makes the parent of the native path dirPath if
543543
// necessary and any directories above that
544544
func (f *Fs) mkParentDir(dirPath string) error {
545+
// defer log.Trace(dirPath, "")("")
546+
// chop off trailing / if it exists
547+
if strings.HasSuffix(dirPath, "/") {
548+
dirPath = dirPath[:len(dirPath)-1]
549+
}
545550
parent := path.Dir(dirPath)
546551
if parent == "." {
547552
parent = ""
@@ -551,10 +556,15 @@ func (f *Fs) mkParentDir(dirPath string) error {
551556

552557
// mkdir makes the directory and parents using native paths
553558
func (f *Fs) mkdir(dirPath string) error {
559+
// defer log.Trace(dirPath, "")("")
554560
// We assume the root is already ceated
555561
if dirPath == "" {
556562
return nil
557563
}
564+
// Collections must end with /
565+
if !strings.HasSuffix(dirPath, "/") {
566+
dirPath += "/"
567+
}
558568
opts := rest.Opts{
559569
Method: "MKCOL",
560570
Path: dirPath,

0 commit comments

Comments
 (0)
0