From 1e20c8cb53542dcb79761a6fd8abcc9ae07ee61e Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 19 Jan 2012 15:50:27 -0500 Subject: [PATCH] Fix saving of "@22" files in snapshots CSS rules were being made available to WebPageDump with double-quotes in the url() rules, despite the original rules not containing them. WPD's regexp for parsing url() rules included the quotes in the captured strings, which prevented relative URLs from being properly interpeted -- they were instead appended to the base URL, resulting in "@22" (") at the end and 404s (sometimes with large HTML pages) that were then saved to disk instead of the image. --- chrome/content/zotero/webpagedump/domsaver.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/webpagedump/domsaver.js b/chrome/content/zotero/webpagedump/domsaver.js index 785c0d317..cdb381e9b 100644 --- a/chrome/content/zotero/webpagedump/domsaver.js +++ b/chrome/content/zotero/webpagedump/domsaver.js @@ -597,7 +597,8 @@ var wpdDOMSaver = { if ( !aCSStext ) return ""; // search for "url" entries inside the css - var re = new RegExp(/ url\(([^\'\)]+)\)/); + // Double-quotes in regexp added by Dan S. for Zotero + var re = new RegExp(/ url\("?([^'")]+)"?\)/); var i = 0; while ( aCSStext.match(re) ) { if ( ++i > 20 ) break; // safer (we try it maximal 20 times for one stylesheet element)