mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 09:34:57 +08:00
Feat: mount storage policy for folders in WebDAV
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user