mirror of
https://github.com/matrix-construct/construct
synced 2025-03-16 22:41:46 +01:00
modules/client/rooms/messages: Relax requirement for a ?from=
parameter.
This commit is contained in:
parent
2dfad15ee8
commit
247544d130
1 changed files with 7 additions and 5 deletions
|
@ -214,20 +214,22 @@ try
|
|||
// Required. The direction to return events from. One of: ["b", "f"]
|
||||
request.query.at("dir").at(0)
|
||||
}
|
||||
,from
|
||||
{
|
||||
// Required. The token to start returning events from. This token can be
|
||||
// obtained from a prev_batch token returned for each room by the sync
|
||||
// API, or from a start or end token returned by a previous request to
|
||||
// this endpoint.
|
||||
url::decode(from, request.query.at("from"))
|
||||
}
|
||||
{
|
||||
//
|
||||
// NOTE: Synapse doesn't require this and many clients have forgotten to
|
||||
// NOTE: use it so we have to relax the requirement here.
|
||||
if(!empty(request.query["from"]))
|
||||
from = url::decode(from, request.query.at("from"));
|
||||
|
||||
// The token to stop returning events at. This token can be obtained from
|
||||
// a prev_batch token returned for each room by the sync endpoint, or from
|
||||
// a start or end token returned by a previous request to this endpoint.
|
||||
if(!empty(request.query["to"]))
|
||||
url::decode(to, request.query.at("to"));
|
||||
to = url::decode(to, request.query.at("to"));
|
||||
|
||||
if(dir != 'b' && dir != 'f')
|
||||
throw m::BAD_PAGINATION
|
||||
|
|
Loading…
Add table
Reference in a new issue