summary refs log tree commit diff
path: root/synapse/rest/media/v1/upload_resource.py
diff options
context:
space:
mode:
authorDaniel Wagner-Hall <daniel@matrix.org>2015-08-28 15:35:39 +0100
committerDaniel Wagner-Hall <daniel@matrix.org>2015-08-28 15:35:39 +0100
commit4d1ea4000856cd29778da2616fb8f602892905e0 (patch)
tree68e4786675aa53586f31b27608f5acfe69a687af /synapse/rest/media/v1/upload_resource.py
parentAllow users to redact their own events (diff)
parentMerge branch 'release-v0.10.0' into develop (diff)
downloadsynapse-4d1ea4000856cd29778da2616fb8f602892905e0.tar.xz
Merge branch 'develop' into redactyoself
Conflicts:
	synapse/handlers/_base.py
Diffstat (limited to 'synapse/rest/media/v1/upload_resource.py')
-rw-r--r--synapse/rest/media/v1/upload_resource.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/synapse/rest/media/v1/upload_resource.py b/synapse/rest/media/v1/upload_resource.py
index 439d5a30a8..6abaf56b25 100644
--- a/synapse/rest/media/v1/upload_resource.py
+++ b/synapse/rest/media/v1/upload_resource.py
@@ -15,7 +15,7 @@
 
 from synapse.http.server import respond_with_json, request_handler
 
-from synapse.util.stringutils import random_string, is_ascii
+from synapse.util.stringutils import random_string
 from synapse.api.errors import SynapseError
 
 from twisted.web.server import NOT_DONE_YET
@@ -86,9 +86,13 @@ class UploadResource(BaseMediaResource):
 
         upload_name = request.args.get("filename", None)
         if upload_name:
-            upload_name = upload_name[0]
-            if upload_name and not is_ascii(upload_name):
-                raise SynapseError(400, "filename must be ascii")
+            try:
+                upload_name = upload_name[0].decode('UTF-8')
+            except UnicodeDecodeError:
+                raise SynapseError(
+                    msg="Invalid UTF-8 filename parameter: %r" % (upload_name),
+                    code=400,
+                )
 
         headers = request.requestHeaders