forked from cadence/out-of-your-element
allow slashes in state keys
This commit is contained in:
parent
33dd73f809
commit
0caaa0940b
3 changed files with 25 additions and 7 deletions
|
@ -121,7 +121,8 @@ async function sendState(roomID, type, stateKey, content, mxid) {
|
|||
assert.ok(type)
|
||||
assert.ok(typeof stateKey === "string")
|
||||
/** @type {Ty.R.EventSent} */
|
||||
const root = await mreq.mreq("PUT", path(`/client/v3/rooms/${roomID}/state/${type}/${stateKey}`, mxid), content)
|
||||
// encodeURIComponent is necessary because state key can contain some special characters like / but you must encode them so they fit in a single component of the URI
|
||||
const root = await mreq.mreq("PUT", path(`/client/v3/rooms/${roomID}/state/${type}/${encodeURIComponent(stateKey)}`, mxid), content)
|
||||
return root.event_id
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue