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 f54b75f
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, while converting from string to int", 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 f54b75f

Please sign in to comment.