psi-4ward / psitransfer

Simple open source self-hosted file sharing solution.
BSD 2-Clause "Simplified" License
1.46k stars 211 forks source link

Admin page gives NaN on Sum #217

Open laudaniels opened 2 years ago

laudaniels commented 2 years ago

The Sum gives me NaN. I changed the code in Admin.vue to display the correct result. changes for the humanFileSize function:

    humanFileSize($size) {
            $precision = 2
            $units = array('B','kB','MB','GB','TB','PB','EB','ZB','YB');
            $step = 1024;
            $i = 0;
                while (($size / $step) > 0.9) {
                    $size = $size / $step;
                    $i++;
                }
            return round($size, $precision).$units[$i];
            },
},

Maybe someone can add this to the code.