mirror of
https://github.com/harivansh-afk/betterNAS.git
synced 2026-04-15 13:03:43 +00:00
Fix macOS Finder WebDAV mount by handling GET on directories (#12)
Go's webdav.Handler returns 405 Method Not Allowed for GET on collections (directories). macOS Finder sends GET to the WebDAV root as part of its mount flow and refuses to connect when it gets 405. Add a finderCompatible wrapper that intercepts GET/HEAD on directories and returns a minimal 200 response, while passing all standard WebDAV methods through to the underlying handler unchanged.
This commit is contained in:
parent
b74db855c8
commit
18b6ac625f
2 changed files with 63 additions and 2 deletions
|
|
@ -155,12 +155,13 @@ func (a *app) handler() http.Handler {
|
|||
|
||||
for _, mount := range a.exportMounts {
|
||||
mountPathPrefix := strings.TrimSuffix(mount.mountPath, "/")
|
||||
fs := webdav.Dir(mount.exportPath)
|
||||
dav := &webdav.Handler{
|
||||
Prefix: mountPathPrefix,
|
||||
FileSystem: webdav.Dir(mount.exportPath),
|
||||
FileSystem: fs,
|
||||
LockSystem: webdav.NewMemLS(),
|
||||
}
|
||||
mux.Handle(mount.mountPath, a.requireDAVAuth(mount, dav))
|
||||
mux.Handle(mount.mountPath, a.requireDAVAuth(mount, finderCompatible(dav, fs, mountPathPrefix)))
|
||||
}
|
||||
|
||||
return mux
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue