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.
This commit is contained in:
Dan Stillman 2012-01-19 15:50:27 -05:00
parent f047999339
commit 1e20c8cb53

View File

@ -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)