mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2025-10-27 19:53:41 +08:00
24 lines
512 B
Go
24 lines
512 B
Go
package ctrl
|
|
|
|
import (
|
|
. "github.com/mickael-kerjean/filestash/server/common"
|
|
"github.com/mickael-kerjean/filestash/server/model"
|
|
"github.com/mickael-kerjean/net/webdav"
|
|
"net/http"
|
|
)
|
|
|
|
func WebdavHandler(ctx App, res http.ResponseWriter, req *http.Request) {
|
|
if ctx.Share.Id == "" {
|
|
http.NotFound(res, req)
|
|
return
|
|
}
|
|
|
|
return
|
|
h := &webdav.Handler{
|
|
Prefix: "/s/" + ctx.Share.Id,
|
|
FileSystem: model.NewWebdavFs(ctx.Backend, ctx.Share.Path),
|
|
LockSystem: webdav.NewMemLS(),
|
|
}
|
|
h.ServeHTTP(res, req)
|
|
}
|