www

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

commit 2562e64e82787f0d7557d1cb296f9a41dad1cc31
parent 4ea05ce0912ee25cc7779eb57496113f3f9ec258
Author: Dan Stillman <dstillman@zotero.org>
Date:   Mon, 14 Jan 2013 20:27:25 -0500

Strip control characters when displaying child notes as well

Diffstat:
Mchrome/content/zotero/xpcom/report.js | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/chrome/content/zotero/xpcom/report.js b/chrome/content/zotero/xpcom/report.js @@ -113,7 +113,13 @@ Zotero.Report = new function() { // If not valid XML, display notes with entities encoded var parser = Components.classes["@mozilla.org/xmlextras/domparser;1"] .createInstance(Components.interfaces.nsIDOMParser); - var doc = parser.parseFromString('<div>' + note.note.replace(/&nbsp;/g, "&#160;") + '</div>', "application/xml"); + var doc = parser.parseFromString('<div>' + + note.note + .replace(/&nbsp;/g, "&#160;") + // Strip control characters (for notes that were + // added before item.setNote() started doing this) + .replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g, "") + + '</div>', "application/xml"); if (doc.documentElement.tagName == 'parsererror') { Zotero.debug(doc.documentElement.textContent, 2); content += '<p class="plaintext">' + escapeXML(note.note) + '</p>\n';