From 0d4b597c1a1fabe1da42c63020fc4217c3db70ca Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Fri, 30 Sep 2022 07:29:09 +0300 Subject: [PATCH] URL-encode values passed to /_synapse/admin/v1/users/{id}/login Fixes https://github.com/devture/matrix-corporal/issues/22 --- corporal/connector/synapse.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/corporal/connector/synapse.go b/corporal/connector/synapse.go index d077670..2301efe 100644 --- a/corporal/connector/synapse.go +++ b/corporal/connector/synapse.go @@ -1,9 +1,8 @@ package connector import ( - "devture-matrix-corporal/corporal/matrix" - "devture-matrix-corporal/corporal/util" "fmt" + "net/url" "sync" "time" @@ -11,6 +10,9 @@ import ( "crypto/sha1" "github.com/matrix-org/gomatrix" + + "devture-matrix-corporal/corporal/matrix" + "devture-matrix-corporal/corporal/util" ) const ( @@ -110,7 +112,7 @@ func (me *SynapseConnector) ObtainNewAccessTokenForUserId(userId, deviceId strin var response matrix.ApiAdminResponseUserLogin err = client.MakeRequest( "POST", - buildPrefixlessURL(client, fmt.Sprintf("/_synapse/admin/v1/users/%s/login", userId), map[string]string{}), + buildPrefixlessURL(client, fmt.Sprintf("/_synapse/admin/v1/users/%s/login", url.QueryEscape(userId)), map[string]string{}), requestPayload, &response, )