Commit ab2226cf authored by Jerome Flesch's avatar Jerome Flesch

Core: HTTP: encode binary files in base64.

Seems required due to the content-type=x-www-form-urlencoded
Signed-off-by: Jerome Flesch's avatarJerome Flesch <jflesch@openpaper.work>
parent 267eac94
Pipeline #169520 passed with stages
in 24 minutes
......@@ -2,6 +2,7 @@
module 'http' contains all the code to communicate with
https://openpaper.work/
"""
import base64
import http
import http.client
import json
......@@ -42,10 +43,10 @@ class JsonHttp(object):
core.call_all("config_register", k, setting)
def _convert(self, data):
if isinstance(data, bytes):
return data
if isinstance(data, str):
return data
if isinstance(data, bytes):
return base64.encodebytes(data).decode("utf-8").strip()
return json.dumps(data)
def _request(self, data, protocol, server, path):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment