forked from TrueCloudLab/rclone
webdav: ensure we call MKCOL with a URL with a trailing / #2350
This is an attempt to fix rclone and qnap interop.
This commit is contained in:
parent
56e1e82005
commit
e7ae5e8ee0
1 changed files with 10 additions and 0 deletions
|
@ -542,6 +542,11 @@ func (f *Fs) PutStream(in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption
|
||||||
// mkParentDir makes the parent of the native path dirPath if
|
// mkParentDir makes the parent of the native path dirPath if
|
||||||
// necessary and any directories above that
|
// necessary and any directories above that
|
||||||
func (f *Fs) mkParentDir(dirPath string) error {
|
func (f *Fs) mkParentDir(dirPath string) error {
|
||||||
|
// defer log.Trace(dirPath, "")("")
|
||||||
|
// chop off trailing / if it exists
|
||||||
|
if strings.HasSuffix(dirPath, "/") {
|
||||||
|
dirPath = dirPath[:len(dirPath)-1]
|
||||||
|
}
|
||||||
parent := path.Dir(dirPath)
|
parent := path.Dir(dirPath)
|
||||||
if parent == "." {
|
if parent == "." {
|
||||||
parent = ""
|
parent = ""
|
||||||
|
@ -551,10 +556,15 @@ func (f *Fs) mkParentDir(dirPath string) error {
|
||||||
|
|
||||||
// mkdir makes the directory and parents using native paths
|
// mkdir makes the directory and parents using native paths
|
||||||
func (f *Fs) mkdir(dirPath string) error {
|
func (f *Fs) mkdir(dirPath string) error {
|
||||||
|
// defer log.Trace(dirPath, "")("")
|
||||||
// We assume the root is already ceated
|
// We assume the root is already ceated
|
||||||
if dirPath == "" {
|
if dirPath == "" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
// Collections must end with /
|
||||||
|
if !strings.HasSuffix(dirPath, "/") {
|
||||||
|
dirPath += "/"
|
||||||
|
}
|
||||||
opts := rest.Opts{
|
opts := rest.Opts{
|
||||||
Method: "MKCOL",
|
Method: "MKCOL",
|
||||||
Path: dirPath,
|
Path: dirPath,
|
||||||
|
|
Loading…
Add table
Reference in a new issue