www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit ff5007fdeabc58d8948525f8e9b48425ae75ed68
parent 490d24f43b52a363f38d06d7858bb547db4a7073
Author: Dan Stillman <dstillman@zotero.org>
Date:   Wed,  3 Sep 2014 19:39:32 -0400

Fix error fetching empty file via File.getContentsAsync()

Diffstat:
Mchrome/content/zotero/xpcom/file.js | 12+++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/chrome/content/zotero/xpcom/file.js b/chrome/content/zotero/xpcom/file.js @@ -212,10 +212,20 @@ Zotero.File = new function(){ } try { + var bytesToFetch = inputStream.available(); + if (maxLength && maxLength < bytesToFetch) { + bytesToFetch = maxLength; + } + + if (bytesToFetch == 0) { + deferred.resolve(""); + return; + } + deferred.resolve( NetUtil.readInputStreamToString( inputStream, - Math.min(maxLength, inputStream.available()), + bytesToFetch, options ) );