commit 5586b409e95d8d900a1505667fc0ace640bfdf1b
parent c7e811198f975c8a6c91e259398f905e5fb2c5c4
Author: Dan Stillman <dstillman@gmail.com>
Date: Mon, 12 Nov 2012 15:03:56 -0800
Merge pull request #196 from aurimasv/fixRelLink
Remove 'about:blank?' from all links
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/chrome/content/zotero/webpagedump/domsaver.js b/chrome/content/zotero/webpagedump/domsaver.js
@@ -496,7 +496,7 @@ var wpdDOMSaver = {
// currentURL to the URL of the frame document and afterwards back to the baseURL
if (this.frameNumber < this.frameList.length) {
var newFileName = this.saveDocumentEx(this.frameList[this.frameNumber++].document, this.name + "_" + this.frameNumber);
- aNode.setAttribute("src", newFileName);
+ aNode.setAttribute("src", this.relativeLinkFix(newFileName));
}
} catch (ex) {
wpdCommon.addError("[wpdCommon.processDOMNode]:\n -> aNode.nodeName: " + aNode.nodeName + "\n -> " + ex);
@@ -574,7 +574,9 @@ var wpdDOMSaver = {
return aHTMLText;
},
-
+ // While we're replacing references with local file paths,
+ // we don't want to have the browser try and fetch them
+ // We prefix them with 'about:blank?' and remove later via repairRelativeLinks
relativeLinkFix: function (aFileName) {
return "about:blank?" + aFileName;
},
@@ -584,7 +586,7 @@ var wpdDOMSaver = {
// that sending an invalid request to the server when the img src
// is a relative link to a file in a different directory
repairRelativeLinks: function (aHTMLText) {
- return aHTMLText.replace(/(src)="about:blank\?([^"]*)"/g, '$1="$2"');
+ return aHTMLText.replace(/(src|background|data|href)="about:blank\?([^"]*)"/g, '$1="$2"');
},