API: Fix storing dashboard with static UID (#43861)

* API: Fix storing dashboard with static UID
This commit is contained in:
Sofia Papagiannaki
2022-01-11 18:39:53 +02:00
committed by GitHub
parent ed5c664e4a
commit 963ae4ef87
2 changed files with 27 additions and 7 deletions
+3 -3
View File
@@ -323,13 +323,13 @@ func (hs *HTTPServer) postDashboard(c *models.ReqContext, cmd models.SaveDashboa
if dash.Id != 0 {
data, err := svc.GetProvisionedDashboardDataByDashboardID(dash.Id)
if err != nil {
return response.Error(500, "Error while checking if dashboard is provisioned", err)
return response.Error(500, "Error while checking if dashboard is provisioned using ID", err)
}
provisioningData = data
} else if dash.Uid != "" {
data, err := svc.GetProvisionedDashboardDataByDashboardUID(dash.OrgId, dash.Uid)
if err != nil && !errors.Is(err, models.ErrProvisionedDashboardNotFound) {
return response.Error(500, "Error while checking if dashboard is provisioned", err)
if err != nil && (!errors.Is(err, models.ErrProvisionedDashboardNotFound) && !errors.Is(err, models.ErrDashboardNotFound)) {
return response.Error(500, "Error while checking if dashboard is provisioned using UID", err)
}
provisioningData = data
}