From c45353efec7a6e7680233379872fe09eada81462 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 24 Apr 2019 19:19:06 -0700 Subject: [PATCH] ircd::json: Preserve string quotes for typed comparisons here. --- ircd/json.cc | 4 ++-- modules/m_event.cc | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ircd/json.cc b/ircd/json.cc index 90a6cdf81..7baffc0ea 100644 --- a/ircd/json.cc +++ b/ircd/json.cc @@ -3781,7 +3781,7 @@ const !bool(integer); case STRING: - return string? !len || string_view{*this} == empty_string: + return string? !len || (serial && string_view{string, len} == empty_string): true; case OBJECT: @@ -3821,7 +3821,7 @@ const !bool(integer); case STRING: - return !string || !len || (serial && string_view{*this} == empty_string); + return !string || !len || (serial && string_view{string, len} == empty_string); case OBJECT: return serial? !len || string_view{*this} == empty_object: diff --git a/modules/m_event.cc b/modules/m_event.cc index 948cbfb8b..7408bcb00 100644 --- a/modules/m_event.cc +++ b/modules/m_event.cc @@ -1410,49 +1410,49 @@ ircd::m::essential(m::event event, { content = json::stringify(essential, json::members { - { "aliases", unquote(content.at("aliases")) } + { "aliases", content.at("aliases") } }); } else if(type == "m.room.create") { content = json::stringify(essential, json::members { - { "creator", unquote(content.at("creator")) } + { "creator", content.at("creator") } }); } else if(type == "m.room.history_visibility") { content = json::stringify(essential, json::members { - { "history_visibility", unquote(content.at("history_visibility")) } + { "history_visibility", content.at("history_visibility") } }); } else if(type == "m.room.join_rules") { content = json::stringify(essential, json::members { - { "join_rule", unquote(content.at("join_rule")) } + { "join_rule", content.at("join_rule") } }); } else if(type == "m.room.member") { content = json::stringify(essential, json::members { - { "membership", unquote(content.at("membership")) } + { "membership", content.at("membership") } }); } else if(type == "m.room.power_levels") { content = json::stringify(essential, json::members { - { "ban", unquote(content.at("ban")) }, - { "events", unquote(content.at("events")) }, - { "events_default", unquote(content.at("events_default")) }, - { "kick", unquote(content.at("kick")) }, - { "redact", unquote(content.at("redact")) }, - { "state_default", unquote(content.at("state_default")) }, - { "users", unquote(content.at("users")) }, - { "users_default", unquote(content.at("users_default")) }, + { "ban", content.at("ban") }, + { "events", content.at("events") }, + { "events_default", content.at("events_default") }, + { "kick", content.at("kick") }, + { "redact", content.at("redact") }, + { "state_default", content.at("state_default") }, + { "users", content.at("users") }, + { "users_default", content.at("users_default") }, }); } else if(type == "m.room.redaction")