fix: isolate admin WebDAV path by username

This commit is contained in:
OpenClaw Agent
2026-09-17 06:50:33 +08:00
parent 020944d4a0
commit 215c38f4fb
+3 -2
View File
@@ -21,7 +21,7 @@ func cleanWebDAVRoot(root string) string {
func (a *App) initializeUserWebDAVDefaults() error { func (a *App) initializeUserWebDAVDefaults() error {
var users []User var users []User
if err := a.db.Where("role <> ?", RoleAdmin).Find(&users).Error; err != nil { if err := a.db.Find(&users).Error; err != nil {
return err return err
} }
for _, user := range users { for _, user := range users {
@@ -127,5 +127,6 @@ func (a *App) storageForTask(t *Task) (RemoteStorage, string, bool) {
if a.db.Where("user_id = ?", user.ID).First(&cfg).Error == nil && cfg.RootPath != "" { if a.db.Where("user_id = ?", user.ID).First(&cfg).Error == nil && cfg.RootPath != "" {
return a.storage, cfg.RootPath, true return a.storage, cfg.RootPath, true
} }
return a.storage, a.cfg.WebDAVPath, true root := cleanWebDAVRoot(strings.TrimRight(a.cfg.WebDAVPath, "/") + "/" + user.Username)
return a.storage, root, true
} }