Fix snapshot saves refetching page instead of using passed html
This commit is contained in:
parent
9ed8bed778
commit
ffbe44a159
4 changed files with 10 additions and 5 deletions
|
@ -753,7 +753,7 @@ Zotero.Attachments = new function(){
|
||||||
|
|
||||||
if ((contentType === 'text/html' || contentType === 'application/xhtml+xml')
|
if ((contentType === 'text/html' || contentType === 'application/xhtml+xml')
|
||||||
// Documents from XHR don't work here
|
// Documents from XHR don't work here
|
||||||
&& document instanceof Ci.nsIDOMDocument) {
|
&& Zotero.Translate.DOMWrapper.unwrap(document) instanceof Ci.nsIDOMDocument) {
|
||||||
Zotero.debug('Saving document with saveDocument()');
|
Zotero.debug('Saving document with saveDocument()');
|
||||||
yield Zotero.Utilities.Internal.saveDocument(document, tmpFile);
|
yield Zotero.Utilities.Internal.saveDocument(document, tmpFile);
|
||||||
}
|
}
|
||||||
|
|
|
@ -929,6 +929,7 @@ Zotero.Server.Connector.SaveSnapshot.prototype = {
|
||||||
|
|
||||||
var parser = Components.classes["@mozilla.org/xmlextras/domparser;1"]
|
var parser = Components.classes["@mozilla.org/xmlextras/domparser;1"]
|
||||||
.createInstance(Components.interfaces.nsIDOMParser);
|
.createInstance(Components.interfaces.nsIDOMParser);
|
||||||
|
parser.init(null, Services.io.newURI(data.url));
|
||||||
var doc = parser.parseFromString(`<html>${data.html}</html>`, 'text/html');
|
var doc = parser.parseFromString(`<html>${data.html}</html>`, 'text/html');
|
||||||
doc = Zotero.HTTP.wrapDocument(doc, data.url);
|
doc = Zotero.HTTP.wrapDocument(doc, data.url);
|
||||||
|
|
||||||
|
|
|
@ -462,7 +462,7 @@ Zotero.Utilities.Internal = {
|
||||||
wbp.progressListener = listener;
|
wbp.progressListener = listener;
|
||||||
|
|
||||||
wbp.saveDocument(
|
wbp.saveDocument(
|
||||||
document,
|
Zotero.Translate.DOMWrapper.unwrap(document),
|
||||||
Zotero.File.pathToFile(destFile),
|
Zotero.File.pathToFile(destFile),
|
||||||
Zotero.File.pathToFile(filesFolder),
|
Zotero.File.pathToFile(filesFolder),
|
||||||
null,
|
null,
|
||||||
|
|
|
@ -2121,9 +2121,13 @@ Zotero.WebProgressFinishListener = function(onFinish) {
|
||||||
let contentType = null;
|
let contentType = null;
|
||||||
try {
|
try {
|
||||||
let r = _request || req;
|
let r = _request || req;
|
||||||
_request.QueryInterface(Components.interfaces.nsIHttpChannel);
|
if (!r) {
|
||||||
status = r.responseStatus;
|
Zotero.debug("WebProgressFinishListener: finished without a valid request")
|
||||||
contentType = r.contentType;
|
} else {
|
||||||
|
r.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||||
|
status = r.responseStatus;
|
||||||
|
contentType = r.contentType;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
Zotero.debug(e, 2);
|
Zotero.debug(e, 2);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue