Skip to content

Commit

Permalink
Merge pull request #100950 from HolonProduction/this-time-we-are-spec…
Browse files Browse the repository at this point in the history
…-compliant-i-think

JSONRPC: Convert ids to int if they are int by value
  • Loading branch information
akien-mga committed Jan 14, 2025
2 parents 85b066a + 9db804f commit 488ee4f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modules/jsonrpc/jsonrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ Variant JSONRPC::process_action(const Variant &p_action, bool p_process_arr_elem
Variant id;
if (dict.has("id")) {
id = dict["id"];

// Account for implementations that discern between int and float on the json serialization level, by using an int if there is a .0 fraction. See #100914
if (id.get_type() == Variant::FLOAT && id.operator float() == (float)(id.operator int())) {
id = id.operator int();
}
}

if (object == nullptr || !object->has_method(method)) {
Expand Down

0 comments on commit 488ee4f

Please sign in to comment.