From 824eb06c73e65d887c508037599229a4f18df0e1 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 27 Apr 2011 21:33:01 +0000 Subject: [PATCH] Add temporary workaround for XML parsing errors on imported notes in generated reports Still invalid XML, but serve as text/html to avoid error --- components/zotero-protocol-handler.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/components/zotero-protocol-handler.js b/components/zotero-protocol-handler.js index e5b3abedf..3f00161c6 100644 --- a/components/zotero-protocol-handler.js +++ b/components/zotero-protocol-handler.js @@ -470,9 +470,22 @@ function ChromeExtensionHandler() { break; default: + var content = Zotero.Report.generateHTMLDetails(items, combineChildItems); + + // Serve invalid XML as text/html + // + // This is a temporary workaround until we figure out + // something better. + try { + var xml = new XML(content.replace(/^<\!DOCTYPE [^>]+>\n/, '').trim()); + mimeType = 'application/xhtml+xml'; + } + catch (e) { + Zotero.debug(e); + mimeType = 'text/html'; + } + format = 'html'; - mimeType = 'application/xhtml+xml'; - content = Zotero.Report.generateHTMLDetails(items, combineChildItems); } } catch (e){