summaryrefslogtreecommitdiffstats
path: root/deluge/ui
diff options
context:
space:
mode:
authoribizaman <ibizapeanut@gmail.com>2022-05-28 00:02:47 -0700
committerCalum Lind <calumlind+deluge@gmail.com>2022-06-12 16:08:36 +0100
commitb0dba97fec8dccdaa45f1112f84068cf7415a4ed (patch)
tree6e9b97f30d523768b8dc261005a1dd540f4d6fa7 /deluge/ui
parentd7c520c85ead7960eebbbe9bf883f8d16a7e92a6 (diff)
downloaddeluge-b0dba97fec8dccdaa45f1112f84068cf7415a4ed.tar.gz
deluge-b0dba97fec8dccdaa45f1112f84068cf7415a4ed.tar.bz2
deluge-b0dba97fec8dccdaa45f1112f84068cf7415a4ed.zip
[Web] Accept charset in content-type for json messages
Trac: https://dev.deluge-torrent.org/ticket/3521 Closes: https://github.com/deluge-torrent/deluge/pull/385
Diffstat (limited to 'deluge/ui')
-rw-r--r--deluge/ui/web/json_api.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/deluge/ui/web/json_api.py b/deluge/ui/web/json_api.py
index c487ddf3c..3f256140e 100644
--- a/deluge/ui/web/json_api.py
+++ b/deluge/ui/web/json_api.py
@@ -6,6 +6,7 @@
# See LICENSE for more details.
#
+import cgi
import json
import logging
import os
@@ -190,7 +191,7 @@ class JSON(resource.Resource, component.Component):
Handler to take the json data as a string and pass it on to the
_handle_request method for further processing.
"""
- content_type = request.getHeader(b'content-type').decode()
+ content_type, _ = cgi.parse_header(request.getHeader(b'content-type').decode())
if content_type != 'application/json':
message = 'Invalid JSON request content-type: %s' % content_type
raise JSONException(message)