mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-04 09:14:55 -04:00
Enforce ascii filenames for uploads
This commit is contained in:
parent
2124f668db
commit
9beaedd164
3 changed files with 15 additions and 1 deletions
|
@ -15,7 +15,7 @@
|
|||
|
||||
from synapse.http.server import respond_with_json, request_handler
|
||||
|
||||
from synapse.util.stringutils import random_string
|
||||
from synapse.util.stringutils import random_string, is_ascii
|
||||
from synapse.api.errors import SynapseError
|
||||
|
||||
from twisted.web.server import NOT_DONE_YET
|
||||
|
@ -87,6 +87,8 @@ 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")
|
||||
|
||||
headers = request.requestHeaders
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue