fix (webdav): network drive via window

This commit is contained in:
MickaelK 2025-01-21 16:54:01 +11:00
parent 753e76d4af
commit f53dc6a7a3

View file

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