Strip path from initial request and consistency changes

This commit is contained in:
Henrique Dias committed 2017-06-27 10:45:06 +01:00
1 parent 6bce6fb584
commit 5f98fd89a8
7 files changed
+50 -51

No files matched your search

+2 -2
View File
@@ -12,7 +12,7 @@ func serveWebDAV(ctx *requestContext, w http.ResponseWriter, r *http.Request) (i
var err error
// Checks for user permissions relatively to this path.
if !ctx.User.Allowed(strings.TrimPrefix(r.URL.Path, ctx.FileManager.WebDavURL)) {
if !ctx.User.Allowed(strings.TrimPrefix(r.URL.Path, ctx.FileManager.webDavURL)) {
return http.StatusForbidden, nil
}
@@ -26,7 +26,7 @@ func serveWebDAV(ctx *requestContext, w http.ResponseWriter, r *http.Request) (i
//
// It was decided on https://github.com/hacdias/caddy-filemanager/issues/85
// that GET, for collections, will return the same as PROPFIND method.
path := strings.Replace(r.URL.Path, ctx.FileManager.WebDavURL, "", 1)
path := strings.Replace(r.URL.Path, ctx.FileManager.webDavURL, "", 1)
path = ctx.User.scope + "/" + path
path = filepath.Clean(path)