mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-31 23:22:03 +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
|
||||
}
|
||||
|
||||
func UpdateDashboard(data *map[string]interface{}) (*Dashboard, *model.ApiError) {
|
||||
|
||||
uuid := (*data)["uuid"].(string)
|
||||
func UpdateDashboard(uuid string, data *map[string]interface{}) (*Dashboard, *model.ApiError) {
|
||||
|
||||
map_data, err := json.Marshal(data)
|
||||
if err != nil {
|
||||
@ -224,12 +222,7 @@ func (d *Dashboard) UpdateSlug() {
|
||||
|
||||
func IsPostDataSane(data *map[string]interface{}) error {
|
||||
|
||||
val, ok := (*data)["uuid"]
|
||||
if !ok || val == nil {
|
||||
return fmt.Errorf("uuid not found in post data")
|
||||
}
|
||||
|
||||
val, ok = (*data)["title"]
|
||||
val, ok := (*data)["title"]
|
||||
if !ok || val == nil {
|
||||
return fmt.Errorf("title not found in post data")
|
||||
}
|
||||
|
@ -13,10 +13,10 @@ import (
|
||||
"github.com/prometheus/prometheus/promql"
|
||||
"go.signoz.io/query-service/app/dashboards"
|
||||
"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/telemetry"
|
||||
"go.signoz.io/query-service/version"
|
||||
am "go.signoz.io/query-service/integrations/alertManager"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
@ -337,12 +337,7 @@ func (aH *APIHandler) updateDashboard(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if postData["uuid"] != uuid {
|
||||
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)
|
||||
dashboard, apiError := dashboards.UpdateDashboard(uuid, &postData)
|
||||
|
||||
if apiError != nil {
|
||||
aH.respondError(w, apiError, nil)
|
||||
|
Loading…
x
Reference in New Issue
Block a user