diff --git a/src/files/file/File.js b/src/files/file/File.js index b866fb1ea..fa0882179 100644 --- a/src/files/file/File.js +++ b/src/files/file/File.js @@ -95,7 +95,7 @@ const File = ({ styles.borderTop = '1px solid #eee' } - size = size ? humanSize(size, { round: 0 }) : '-' + size = humanSize(size, { round: 0 }) const hash = cid.toString() || t('hashUnavailable') const select = (select) => onSelect(name, select) diff --git a/src/lib/files.js b/src/lib/files.js index b785a8ed9..be47e51b1 100644 --- a/src/lib/files.js +++ b/src/lib/files.js @@ -173,7 +173,7 @@ export async function getCarLink (files, gatewayUrl, ipfs) { * @returns {string} human-readable size */ export function humanSize (size, opts) { - if (typeof size === 'undefined') return 'N/A' + if (typeof size === 'undefined' || size === null) return 'N/A' return filesize(size || 0, { // base-2 byte units (GiB, MiB, KiB) to remove any ambiguity spacer: String.fromCharCode(160), // non-breakable space ( )