Have Media db return optional content_type, conversion fixes

This commit is contained in:
Devin Ragotzy 2020-11-18 08:36:12 -05:00 committed by Timo Kösters
parent bb24f6ad90
commit b6d721374f
No known key found for this signature in database
GPG key ID: 24DA7517711A2BA4
5 changed files with 47 additions and 31 deletions

View file

@ -499,7 +499,6 @@ impl Rooms {
Ok(())
}
#[allow(clippy::too_many_arguments)]
/// Creates a new persisted data unit and adds it to a room.
///
/// By this point the incoming event should be fully authenticated, no auth happens
@ -856,9 +855,8 @@ impl Rooms {
};
// Hash and sign
let mut pdu_json: BTreeMap<String, ruma::serde::CanonicalJsonValue> =
serde_json::from_value(serde_json::json!(&pdu))
.expect("event is valid, we just created it");
let mut pdu_json =
utils::to_canonical_object(&pdu).expect("event is valid, we just created it");
pdu_json.remove("event_id");