fix: privileged webdav falls back to global storage
This commit is contained in:
+6
-1
@@ -108,7 +108,12 @@ func (a *App) storageForTask(t *Task) (RemoteStorage, string, bool) {
|
||||
}
|
||||
var cfg WebDAVConfig
|
||||
if a.db.Where("user_id = ? AND enabled = ?", user.ID, true).First(&cfg).Error != nil || cfg.URL == "" {
|
||||
return nil, "", false
|
||||
// Privileged users fall back to the global WebDAV until a custom
|
||||
// WebDAV configuration is enabled and tested successfully.
|
||||
if a.cfg.WebDAVURL == "" || a.storage == nil {
|
||||
return nil, "", false
|
||||
}
|
||||
return a.storage, a.cfg.WebDAVPath, true
|
||||
}
|
||||
return NewWebDAVStorage(Config{WebDAVURL: cfg.URL, WebDAVUser: cfg.Username, WebDAVPass: cfg.Password}), cfg.RootPath, true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user