Strip path from initial request and consistency changes

Former-commit-id: ff268e5bbdbcb41bc49725e03cd5afae58882eae [formerly a28207f461e64d25d113fe71393fd69d6d421f32] [formerly 6345aaf2af5ad3ef9923f35de5e0f16dfdafbf55 [formerly 5f98fd89a84ea595a2a4d78ec0dcc6c44af567cf]]
Former-commit-id: 975ee9c065d26fb99bd3a4e84bce6dceac08fd27 [formerly 6bd35709641b93c753ae109d1207933a3805b779]
Former-commit-id: fcc27613bde5397d6463fd9c2465a1e554b9407b
This commit is contained in:
Henrique Dias
2017-06-27 10:45:06 +01:00
parent f0be416253
commit 7f28cebda6
7 changed files with 50 additions and 51 deletions

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)