fix parsing of file size

This commit is contained in:
Uwe Steinmann 2020-06-19 11:36:51 +02:00
parent a4ccfe1a7d
commit f817fc4489

View File

@ -94,12 +94,11 @@ class SeedDMS_Core_File {
*/
static function parse_filesize($str) { /* {{{ */
preg_replace('/\s\s+/', '', $str);
if(strtoupper(substr($str, -1)) == 'B') {
$value = (int) substr($str, 0, -2);
$unit = substr($str, -2, 1);
} else {
if(in_array(strtoupper(substr($str, -1)), array('B','K','M','G'))) {
$value = (int) substr($str, 0, -1);
$unit = substr($str, -1);
$unit = substr($str, -1, 1);
} else {
return (int) $str;
}
switch(strtoupper($unit)) {
case 'G':