diff options
author | Kegan Dougal <kegan@matrix.org> | 2015-03-31 14:00:25 +0100 |
---|---|---|
committer | Kegan Dougal <kegan@matrix.org> | 2015-03-31 14:00:25 +0100 |
commit | 5e88a09a424b8ce65bfe9a809cfd245286474de3 (patch) | |
tree | 931024bff7162392a928f61e9471c8a431467a31 /synapse/storage | |
parent | Use a sender localpart instead of a user ID. (diff) | |
download | synapse-5e88a09a424b8ce65bfe9a809cfd245286474de3.tar.xz |
Add same user_id char checks as registration.
Diffstat (limited to 'synapse/storage')
-rw-r--r-- | synapse/storage/appservice.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/storage/appservice.py b/synapse/storage/appservice.py index 557e377ca5..f8cbb3f323 100644 --- a/synapse/storage/appservice.py +++ b/synapse/storage/appservice.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import logging +import urllib import yaml from simplejson import JSONDecodeError import simplejson as json @@ -209,7 +210,12 @@ class ApplicationServiceStore(SQLBaseStore): if not isinstance(as_info.get(field), basestring): raise KeyError("Required string field: '%s'", field) - user = UserID(as_info["sender_localpart"], self.hostname) + localpart = as_info["sender_localpart"] + if urllib.quote(localpart) != localpart: + raise ValueError( + "sender_localpart needs characters which are not URL encoded." + ) + user = UserID(localpart, self.hostname) user_id = user.to_string() # namespace checks |