mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-27 19:19:21 +03:00
friendlySize() could return NaN
This commit is contained in:
parent
306d3ec7b5
commit
2a14566679
2 changed files with 3 additions and 2 deletions
|
|
@ -273,7 +273,8 @@ export const FileInfo = {
|
|||
},
|
||||
|
||||
friendlySize: bytes => {
|
||||
bytes = parseInt(bytes, 10) || 0;
|
||||
bytes = parseInt(bytes, 10);
|
||||
bytes = isFinite(bytes) ? bytes : 0;
|
||||
let i = bytes ? Math.floor(Math.log(bytes) / Math.log(1024)) : 0;
|
||||
return (bytes / Math.pow(1024, i)).toFixed(2>i ? 0 : 1) + ' ' + sizes[i];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue