From c3c7f0a8ae163382502d11072a1a77f7db8d51ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adomas=20Ven=C4=8Dkauskas?= Date: Wed, 11 Sep 2019 14:05:30 +0300 Subject: [PATCH] Allow /connector/document/respond to take non-double JSON encoded data --- .../zotero/xpcom/connector/server_connectorIntegration.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/connector/server_connectorIntegration.js b/chrome/content/zotero/xpcom/connector/server_connectorIntegration.js index a1328db0cc..35cdf3117c 100644 --- a/chrome/content/zotero/xpcom/connector/server_connectorIntegration.js +++ b/chrome/content/zotero/xpcom/connector/server_connectorIntegration.js @@ -56,8 +56,12 @@ Zotero.Server.Endpoints['/connector/document/respond'].prototype = { supportedDataTypes: ["application/json"], permitBookmarklet: true, - init: function(data, sendResponse) { - data = JSON.parse(data); + init: function (data, sendResponse) { + // Earlier version of the gdocs plugin used to double-encode the JSON data + try { + data = JSON.parse(data); + } + catch (e) {} if (data && data.error) { // Apps Script stack is a JSON object if (typeof data.stack != "string") {