diff --git a/server/model/webdav.go b/server/model/webdav.go index 956154ee..4de0667c 100644 --- a/server/model/webdav.go +++ b/server/model/webdav.go @@ -105,6 +105,12 @@ func (this *WebdavFs) Stat(ctx context.Context, name string) (os.FileInfo, error return this.webdavFile.Stat() } fullname := this.fullpath(name) + if isMicrosoftWebDAVClient(this.req) && this.req.Method == "PROPFIND" { + if name == "" { + fullname = this.chroot + } + fullname = EnforceDirectory(fullname) + } if fullname == "" { return nil, os.ErrNotExist } @@ -328,3 +334,7 @@ func NewWebdavLock() webdav.LockSystem { } return lock } + +func isMicrosoftWebDAVClient(req *http.Request) bool { + return strings.HasPrefix(req.Header.Get("User-Agent"), "Microsoft-WebDAV-MiniRedir/") +}