Fix error fetching empty file via File.getContentsAsync()
This commit is contained in:
parent
490d24f43b
commit
ff5007fdea
1 changed files with 11 additions and 1 deletions
|
@ -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
|
||||
)
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue