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 {
|
try {
|
||||||
|
var bytesToFetch = inputStream.available();
|
||||||
|
if (maxLength && maxLength < bytesToFetch) {
|
||||||
|
bytesToFetch = maxLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bytesToFetch == 0) {
|
||||||
|
deferred.resolve("");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
deferred.resolve(
|
deferred.resolve(
|
||||||
NetUtil.readInputStreamToString(
|
NetUtil.readInputStreamToString(
|
||||||
inputStream,
|
inputStream,
|
||||||
Math.min(maxLength, inputStream.available()),
|
bytesToFetch,
|
||||||
options
|
options
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue