www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 7b469e3d6f16e59910c3bfa7b29d43ff2800f43f
parent 491c44c74c90f643dba33cec6c79cccfd9a0b4f3
Author: Dan Stillman <dstillman@zotero.org>
Date:   Thu, 21 Jul 2011 19:16:19 +0000

Remove unnecessary lastUpdated optimization in translator regexp, allowing lastUpdated to be anywhere in the JSON


Diffstat:
Mchrome/content/zotero/xpcom/translation/translator.js | 12+-----------
1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/chrome/content/zotero/xpcom/translation/translator.js b/chrome/content/zotero/xpcom/translation/translator.js @@ -443,17 +443,7 @@ Zotero.Translator = function(file, json, code) { var str = {}; cStream.readString(MAX_INFO_LENGTH, str); - // We assume lastUpdated is at the end to avoid running the regexp on more than necessary - var lastUpdatedIndex = str.value.indexOf('"lastUpdated"'); - if (lastUpdatedIndex == -1) { - this.logError("Invalid or missing translator metadata JSON object in " + file.leafName); - fStream.close(); - return; - } - - // Add 50 characters to clear lastUpdated timestamp and final "}" - var header = str.value.substr(0, lastUpdatedIndex + 50); - var m = infoRe.exec(header); + var m = infoRe.exec(str.value); if (!m) { this.logError("Invalid or missing translator metadata JSON object in " + file.leafName); fStream.close();