mirror of
https://github.com/rclone/rclone.git
synced 2025-01-03 12:59:32 +01:00
serve webdav: fix --baseurl handling after lib/http refactor
The webdav library was confused by the Path manipulation done by lib/http when stripping the prefix. This patch adds the prefix back before calling it. Fixes #6650
This commit is contained in:
parent
54c0f17f2a
commit
6257a6035c
@ -237,6 +237,9 @@ func (w *WebDAV) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
w.serveDir(rw, r, remote)
|
||||
return
|
||||
}
|
||||
// Add URL Prefix back to path since webdavhandler needs to
|
||||
// return absolute references.
|
||||
r.URL.Path = w.opt.HTTP.BaseURL + r.URL.Path
|
||||
w.webdavhandler.ServeHTTP(rw, r)
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,7 @@ func TestWebDav(t *testing.T) {
|
||||
start := func(f fs.Fs) (configmap.Simple, func()) {
|
||||
opt := DefaultOpt
|
||||
opt.HTTP.ListenAddr = []string{testBindAddress}
|
||||
opt.HTTP.BaseURL = "/prefix"
|
||||
opt.Auth.BasicUser = testUser
|
||||
opt.Auth.BasicPass = testPass
|
||||
opt.Template.Path = testTemplate
|
||||
|
Loading…
Reference in New Issue
Block a user