commit b117da88a3e4334fa2e09a4d1df7b1cbd9bd57d8 parent 4e015ecbe9a12fc01b7b125738b5d559ed02dd52 Author: Simon Kornblith <simon@simonster.com> Date: Sat, 21 Jul 2012 18:28:36 -0400 Don't save unsynchable tags Diffstat:
| M | chrome/content/zotero/xpcom/translation/translate.js | | | 13 | +++++++++++++ |
1 file changed, 13 insertions(+), 0 deletions(-)
diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js @@ -580,6 +580,19 @@ Zotero.Translate.Sandbox = { if(setShortTitle) item.shortTitle = title; } + // refuse to save very long tags + if(item.tags) { + for(var i=0; i<item.tags.length; i++) { + var tag = item.tags[i]; + tagString = typeof tag === "string" ? tag : + typeof tag === "object" ? (tag.tag || tag.name) : null; + if(tagString && tagString.length > 255) { + translate._debug("WARNING: Skipping unsynchable tag "+JSON.stringify(tagString)); + item.tags.splice(i--, 1); + } + } + } + // call super Zotero.Translate.Sandbox.Base._itemDone(translate, item); }