Skip to content

Commit

Permalink
Fix mangled large reports
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dstillman committed Jan 21, 2017
1 parent 9b247eb commit 5236d01
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion components/zotero-protocol-handler.js
Expand Up @@ -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);
}
});
}
Expand Down

0 comments on commit 5236d01

Please sign in to comment.