Feat: mount storage policy for folders in WebDAV

This commit is contained in:
HFO4
2020-02-13 15:27:40 +08:00
parent a0a9686959
commit 44d6ca487c
13 changed files with 76 additions and 12 deletions

View File

@@ -1,6 +1,7 @@
package controllers
import (
model "github.com/HFO4/cloudreve/models"
"github.com/HFO4/cloudreve/pkg/filesystem"
"github.com/HFO4/cloudreve/pkg/util"
"github.com/HFO4/cloudreve/pkg/webdav"
@@ -24,5 +25,18 @@ func ServeWebDAV(c *gin.Context) {
return
}
if webdavCtx, ok := c.Get("webdav"); ok {
application := webdavCtx.(*model.Webdav)
// 重定根目录
if application.Root != "/" {
if exist, root := fs.IsPathExist(application.Root); exist {
root.Position = ""
root.Name = "/"
fs.Root = root
}
}
}
handler.ServeHTTP(c.Writer, c.Request, fs)
}