Fix CodeShare integration on Py3k < 3.6

We should decode the REST API response and not rely on json.loads()
accepting `bytes`, which it does starting with 3.6.

Thanks to @sdroege for reporting!
This commit is contained in:
Ole André Vadla Ravnås
2017-07-29 17:24:09 +02:00
parent 7859a2c0e6
commit 7659b8d70a
+4 -1
View File
@@ -486,7 +486,10 @@ rpc.exports.evaluate = function (expression) {
request = build_opener()
request.addheaders = [('User-Agent', 'Frida v{} | {}'.format(frida.__version__, platform.platform()))]
response = request.open(project_url)
response_content = response.read()
charset = response.headers.get_content_charset()
if charset is None:
charset = 'utf-8'
response_content = response.read().decode(charset)
response_json = json.loads(response_content)
except Exception as e:
self._print("Got an unhandled exception while trying to retrieve {} - {}".format(uri, e))