mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 14:50:55 +03:00
webdav: fix GET as PROPFIND if a prefix is defined
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -26,6 +26,7 @@ import (
|
||||
"path"
|
||||
"path/filepath"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/drakkan/webdav"
|
||||
@@ -137,6 +138,9 @@ func (s *webDavServer) checkRequestMethod(ctx context.Context, r *http.Request,
|
||||
// see RFC4918, section 9.4
|
||||
if r.Method == http.MethodGet || r.Method == http.MethodHead {
|
||||
p := path.Clean(r.URL.Path)
|
||||
if s.binding.Prefix != "" {
|
||||
p = strings.TrimPrefix(p, s.binding.Prefix)
|
||||
}
|
||||
info, err := connection.Stat(ctx, p)
|
||||
if err == nil && info.IsDir() {
|
||||
if r.Method == http.MethodHead {
|
||||
|
||||
Reference in New Issue
Block a user