Skip to content
Snippets Groups Projects
Commit be6e64a8 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Use Math.round() for sizes > 1024 and < 1024000

parent 799124fb
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #1892 passed
......@@ -14,9 +14,11 @@ function file_size_str(size, bytes, precision)
}
if(size == 0)
return "0K";
if(size <= 1024)
return "1K";
size = size/1024;
if(size<1000) /* KB */
return format("%ldK", Math.ceil(size));
return format("%ldK", Math.round(size));
if(size<100000) /* KB With comma */
return format("%ld,%03ldK",(size/1000),(size%1000));
size = size/1024;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment