forked from TrueCloudLab/rclone
serve webdav: fix --baseurl without leading /
The webdav server needs the prefix passed to it with a leading / otherwise it does not remove it properly. The docs state that a leading slash is optional so this patch adds one if not present. See: https://forum.rclone.org/t/cant-rename-files-in-rclone-serve-webdav-with-baseurl-maybe-wrong-handling-of-move-request-method/44637
This commit is contained in:
parent
5014348229
commit
072d1f10ab
1 changed files with 3 additions and 0 deletions
|
@ -203,6 +203,9 @@ func newWebDAV(ctx context.Context, f fs.Fs, opt *Options) (w *WebDAV, err error
|
||||||
return nil, fmt.Errorf("failed to init server: %w", err)
|
return nil, fmt.Errorf("failed to init server: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure BaseURL starts with a / and doesn't end with one
|
||||||
|
w.opt.HTTP.BaseURL = "/" + strings.Trim(w.opt.HTTP.BaseURL, "/")
|
||||||
|
|
||||||
webdavHandler := &webdav.Handler{
|
webdavHandler := &webdav.Handler{
|
||||||
Prefix: w.opt.HTTP.BaseURL,
|
Prefix: w.opt.HTTP.BaseURL,
|
||||||
FileSystem: w,
|
FileSystem: w,
|
||||||
|
|
Loading…
Reference in a new issue