client-api: Fix deserialization of recently changed state endpoint requests
This commit is contained in:
parent
466b8679d6
commit
a07eb4ecff
@ -142,17 +142,21 @@ impl ruma_api::IncomingRequest for IncomingRequest {
|
||||
}
|
||||
};
|
||||
|
||||
let state_key = {
|
||||
let decoded =
|
||||
match percent_encoding::percent_decode(path_segments[7].as_bytes()).decode_utf8() {
|
||||
let state_key = match path_segments.get(7) {
|
||||
Some(segment) => {
|
||||
let decoded = match percent_encoding::percent_decode(segment.as_bytes())
|
||||
.decode_utf8()
|
||||
{
|
||||
Ok(val) => val,
|
||||
Err(err) => return Err(RequestDeserializationError::new(err, request).into()),
|
||||
};
|
||||
|
||||
match String::try_from(&*decoded) {
|
||||
Ok(val) => val,
|
||||
Err(err) => return Err(RequestDeserializationError::new(err, request).into()),
|
||||
match String::try_from(&*decoded) {
|
||||
Ok(val) => val,
|
||||
Err(err) => return Err(RequestDeserializationError::new(err, request).into()),
|
||||
}
|
||||
}
|
||||
None => "".into(),
|
||||
};
|
||||
|
||||
Ok(Self { room_id, event_type, state_key })
|
||||
|
@ -129,11 +129,15 @@ impl ruma_api::IncomingRequest for IncomingRequest {
|
||||
}
|
||||
};
|
||||
|
||||
let state_key =
|
||||
match percent_encoding::percent_decode(path_segments[7].as_bytes()).decode_utf8() {
|
||||
Ok(val) => val.into_owned(),
|
||||
Err(err) => return Err(RequestDeserializationError::new(err, request).into()),
|
||||
};
|
||||
let state_key = match path_segments.get(7) {
|
||||
Some(segment) => {
|
||||
match percent_encoding::percent_decode(segment.as_bytes()).decode_utf8() {
|
||||
Ok(val) => val.into_owned(),
|
||||
Err(err) => return Err(RequestDeserializationError::new(err, request).into()),
|
||||
}
|
||||
}
|
||||
None => "".into(),
|
||||
};
|
||||
|
||||
let content = {
|
||||
let request_body: Box<RawJsonValue> =
|
||||
|
Loading…
x
Reference in New Issue
Block a user