Fix unmarshal of double pointer (#47586) (#47607)

* Fix unmaarshal of double pointer

* update sdk version

(cherry picked from commit 0bf889e058)

Co-authored-by: ying-jeanne <74549700+ying-jeanne@users.noreply.github.com>
This commit is contained in:
Grot (@grafanabot)
2022-04-12 09:42:56 +02:00
committed by GitHub
co-authored by ying-jeanne
parent be54ab63cb
commit bd76bd0d0e
9 changed files with 20 additions and 15 deletions
+2 -2
View File
@@ -56,9 +56,9 @@ func (s Settings) Value() (driver.Value, error) {
func (s *Settings) Scan(value interface{}) error {
switch v := value.(type) {
case string:
return json.Unmarshal([]byte(v), &s)
return json.Unmarshal([]byte(v), s)
case []uint8:
return json.Unmarshal(v, &s)
return json.Unmarshal(v, s)
default:
return fmt.Errorf("type assertion on scan failed: got %T", value)
}
+2 -2
View File
@@ -179,7 +179,7 @@ func (api *ServiceAccountsAPI) updateServiceAccount(c *models.ReqContext) respon
return response.Error(http.StatusBadRequest, "Service Account ID is invalid", err)
}
cmd := &serviceaccounts.UpdateServiceAccountForm{}
var cmd serviceaccounts.UpdateServiceAccountForm
if err := web.Bind(c.Req, &cmd); err != nil {
return response.Error(http.StatusBadRequest, "Bad request data", err)
}
@@ -188,7 +188,7 @@ func (api *ServiceAccountsAPI) updateServiceAccount(c *models.ReqContext) respon
return response.Error(http.StatusBadRequest, "Invalid role specified", nil)
}
resp, err := api.store.UpdateServiceAccount(c.Req.Context(), c.OrgId, scopeID, cmd)
resp, err := api.store.UpdateServiceAccount(c.Req.Context(), c.OrgId, scopeID, &cmd)
if err != nil {
switch {
case errors.Is(err, serviceaccounts.ErrServiceAccountNotFound):