mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-02 18:50:36 +08:00
Merge pull request #997 from SigNoz/dashboard-bug-fix
(bugfix): remove validation on post data id
This commit is contained in:
commit
844ca57686
@ -182,9 +182,7 @@ func GetDashboard(uuid string) (*Dashboard, *model.ApiError) {
|
|||||||
return &dashboard, nil
|
return &dashboard, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func UpdateDashboard(data *map[string]interface{}) (*Dashboard, *model.ApiError) {
|
func UpdateDashboard(uuid string, data *map[string]interface{}) (*Dashboard, *model.ApiError) {
|
||||||
|
|
||||||
uuid := (*data)["uuid"].(string)
|
|
||||||
|
|
||||||
map_data, err := json.Marshal(data)
|
map_data, err := json.Marshal(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -224,12 +222,7 @@ func (d *Dashboard) UpdateSlug() {
|
|||||||
|
|
||||||
func IsPostDataSane(data *map[string]interface{}) error {
|
func IsPostDataSane(data *map[string]interface{}) error {
|
||||||
|
|
||||||
val, ok := (*data)["uuid"]
|
val, ok := (*data)["title"]
|
||||||
if !ok || val == nil {
|
|
||||||
return fmt.Errorf("uuid not found in post data")
|
|
||||||
}
|
|
||||||
|
|
||||||
val, ok = (*data)["title"]
|
|
||||||
if !ok || val == nil {
|
if !ok || val == nil {
|
||||||
return fmt.Errorf("title not found in post data")
|
return fmt.Errorf("title not found in post data")
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,10 @@ import (
|
|||||||
"github.com/prometheus/prometheus/promql"
|
"github.com/prometheus/prometheus/promql"
|
||||||
"go.signoz.io/query-service/app/dashboards"
|
"go.signoz.io/query-service/app/dashboards"
|
||||||
"go.signoz.io/query-service/dao/interfaces"
|
"go.signoz.io/query-service/dao/interfaces"
|
||||||
|
am "go.signoz.io/query-service/integrations/alertManager"
|
||||||
"go.signoz.io/query-service/model"
|
"go.signoz.io/query-service/model"
|
||||||
"go.signoz.io/query-service/telemetry"
|
"go.signoz.io/query-service/telemetry"
|
||||||
"go.signoz.io/query-service/version"
|
"go.signoz.io/query-service/version"
|
||||||
am "go.signoz.io/query-service/integrations/alertManager"
|
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -337,12 +337,7 @@ func (aH *APIHandler) updateDashboard(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if postData["uuid"] != uuid {
|
dashboard, apiError := dashboards.UpdateDashboard(uuid, &postData)
|
||||||
aH.respondError(w, &model.ApiError{Typ: model.ErrorBadData, Err: fmt.Errorf("uuid in request param and uuid in request body do not match")}, "Error reading request body")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
dashboard, apiError := dashboards.UpdateDashboard(&postData)
|
|
||||||
|
|
||||||
if apiError != nil {
|
if apiError != nil {
|
||||||
aH.respondError(w, apiError, nil)
|
aH.respondError(w, apiError, nil)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user