Fix mangled large reports

https://forums.zotero.org/discussion/64022/5-0-beta-generate-report-is-often-garbled

Records are being truncated, though I'm not sure why. But just read the input
stream into a string for now.
This commit is contained in:
Dan Stillman 2017-01-21 06:33:36 -05:00
parent 9b247ebba7
commit 5236d01791

View file

@ -444,12 +444,26 @@ function ZoteroProtocolHandler() {
default:
this.contentType = 'text/html';
return Zotero.Utilities.Internal.getAsyncInputStream(
// DEBUG: Results in mangled reports
//
// https://forums.zotero.org/discussion/64022/5-0-beta-generate-report-is-often-garbled
/*return Zotero.Utilities.Internal.getAsyncInputStream(
Zotero.Report.HTML.listGenerator(items, combineChildItems),
function () {
return '<span style="color: red; font-weight: bold">Error generating report</span>';
}
);*/
Components.utils.import("resource://gre/modules/NetUtil.jsm");
var is = Zotero.Utilities.Internal.getAsyncInputStream(
Zotero.Report.HTML.listGenerator(items, combineChildItems),
function () {
return '<span style="color: red; font-weight: bold">Error generating report</span>';
}
);
var str = NetUtil.readInputStreamToString(is, is.available(), {});
return Zotero.Promise.resolve(str);
}
});
}