Fix incorrect total size displayed for spreadsheets (#318)
This commit is contained in:
@@ -254,15 +254,22 @@ define([
|
|||||||
|
|
||||||
if (common.isLoggedIn() && AppConfig.enablePinning) {
|
if (common.isLoggedIn() && AppConfig.enablePinning) {
|
||||||
// check the size of this file...
|
// check the size of this file...
|
||||||
common.getFileSize(data.channel, function (e, bytes) {
|
var bytes = 0;
|
||||||
if (e) {
|
NThen(function (waitFor) {
|
||||||
// there was a problem with the RPC
|
var chan = [data.channel];
|
||||||
console.error(e);
|
if (data.rtChannel) { chan.push(data.rtChannel); }
|
||||||
|
if (data.lastVersion) { chan.push(Hash.hrefToHexChannelId(data.lastVersion)); }
|
||||||
// but we don't want to break the interface.
|
chan.forEach(function (c) {
|
||||||
// continue as if there was no RPC
|
common.getFileSize(c, waitFor(function (e, _bytes) {
|
||||||
return void cb(void 0, $d);
|
if (e) {
|
||||||
}
|
// there was a problem with the RPC
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
bytes += _bytes;
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}).nThen(function () {
|
||||||
|
if (bytes === 0) { return void cb(void 0, $d); }
|
||||||
var KB = Util.bytesToKilobytes(bytes);
|
var KB = Util.bytesToKilobytes(bytes);
|
||||||
|
|
||||||
var formatted = Messages._getKey('formattedKB', [KB]);
|
var formatted = Messages._getKey('formattedKB', [KB]);
|
||||||
|
|||||||
Reference in New Issue
Block a user