mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Backend plugins: Fix incorrect JSON Unmarshal (#24243)
This commit is contained in:
parent
898df2b778
commit
224aa4dde8
@ -29,21 +29,22 @@ func (hs *HTTPServer) getPluginContext(pluginID string, user *models.SignedInUse
|
|||||||
return pc, ErrPluginNotFound
|
return pc, ErrPluginNotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
var jsonData json.RawMessage
|
jsonData := json.RawMessage{}
|
||||||
var decryptedSecureJSONData map[string]string
|
decryptedSecureJSONData := map[string]string{}
|
||||||
var updated time.Time
|
var updated time.Time
|
||||||
|
|
||||||
ps, err := hs.getCachedPluginSettings(pluginID, user)
|
ps, err := hs.getCachedPluginSettings(pluginID, user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
// models.ErrPluginSettingNotFound is expected if there's no row found for plugin setting in database (if non-app plugin).
|
||||||
|
// If it's not this expected error something is wrong with cache or database and we return the error to the client.
|
||||||
if err != models.ErrPluginSettingNotFound {
|
if err != models.ErrPluginSettingNotFound {
|
||||||
return pc, errutil.Wrap("Failed to get plugin settings", err)
|
return pc, errutil.Wrap("Failed to get plugin settings", err)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
jsonData, err = json.Marshal(ps.JsonData)
|
jsonData, err = json.Marshal(ps.JsonData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return pc, errutil.Wrap("Failed to unmarshal plugin json data", err)
|
return pc, errutil.Wrap("Failed to unmarshal plugin json data", err)
|
||||||
}
|
}
|
||||||
decryptedSecureJSONData = make(map[string]string)
|
|
||||||
} else {
|
|
||||||
decryptedSecureJSONData = ps.DecryptedValues()
|
decryptedSecureJSONData = ps.DecryptedValues()
|
||||||
updated = ps.Updated
|
updated = ps.Updated
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user