royalcat refactoring
This commit is contained in:
parent
1da835cea6
commit
b245c9f451
81 changed files with 1476 additions and 1580 deletions
src/mounts/webdav
23
src/mounts/webdav/handler.go
Normal file
23
src/mounts/webdav/handler.go
Normal file
|
@ -0,0 +1,23 @@
|
|||
package webdav
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"git.kmsign.ru/royalcat/tstor/src/fs"
|
||||
"github.com/rs/zerolog/log"
|
||||
"golang.org/x/net/webdav"
|
||||
)
|
||||
|
||||
func newHandler(fs fs.Filesystem) *webdav.Handler {
|
||||
l := log.Logger.With().Str("component", "webDAV").Logger()
|
||||
return &webdav.Handler{
|
||||
Prefix: "/",
|
||||
FileSystem: newFS(fs),
|
||||
LockSystem: webdav.NewMemLS(),
|
||||
Logger: func(req *http.Request, err error) {
|
||||
if err != nil {
|
||||
l.Error().Err(err).Str("path", req.RequestURI).Msg("webDAV error")
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue