Skip to content

Commit

Permalink
using the correct function to check if existing asn was modified.
Browse files Browse the repository at this point in the history
  • Loading branch information
rimashah25 committed Jul 5, 2023
1 parent d8352bb commit 3c54727
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions traffic_ops/traffic_ops_golang/asn/asns.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,13 @@ func Update(w http.ResponseWriter, r *http.Request) {
return
}

requestedAsnId := inf.Params["id"]
requestedAsnId, convErr := strconv.Atoi(inf.Params["id"])
if convErr != nil {
api.HandleErr(w, r, tx, http.StatusBadRequest, fmt.Errorf("asn update error: %w during string to int conversion", convErr), nil)
return
}
// check if the entity was already updated
userErr, sysErr, errCode = api.CheckIfUnModifiedByName(r.Header, inf.Tx, requestedAsnId, "asn")
userErr, sysErr, errCode = api.CheckIfUnModified(r.Header, inf.Tx, requestedAsnId, "asn")
if userErr != nil || sysErr != nil {
api.HandleErr(w, r, tx, errCode, userErr, sysErr)
return
Expand Down

0 comments on commit 3c54727

Please sign in to comment.