Skip to content

Commit

Permalink
safer casting
Browse files Browse the repository at this point in the history
  • Loading branch information
jaroslaw-pieszka committed Sep 12, 2024
1 parent 453cba5 commit e8c548d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions internal/runtime/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,15 @@ func (h *Handler) getRuntimes(w http.ResponseWriter, req *http.Request) {
dto.RuntimeConfig = nil
default:
// remove managedFields from the object to reduce the size of the response
delete(runtimeResourceObject.Object["metadata"].(map[string]interface{}), "managedFields")
dto.RuntimeConfig = &runtimeResourceObject.Object
_, ok := runtimeResourceObject.Object["metadata"].(map[string]interface{})
if !ok {
h.logger.Warn(fmt.Sprintf("unable to get Runtime resource metadata %s/%s: %s", dto.InstanceID, dto.RuntimeID, err.Error()))
dto.RuntimeConfig = nil

} else {
delete(runtimeResourceObject.Object["metadata"].(map[string]interface{}), "managedFields")
dto.RuntimeConfig = &runtimeResourceObject.Object
}
}
}

Expand Down

0 comments on commit e8c548d

Please sign in to comment.