diff --git a/app/Http/Controllers/IndexController.php b/app/Http/Controllers/IndexController.php index 03f31db00..04014a2fd 100755 --- a/app/Http/Controllers/IndexController.php +++ b/app/Http/Controllers/IndexController.php @@ -274,10 +274,11 @@ class IndexController extends InvokeController continue; } $fileName = Base::leftDelete($file, $dirPath); + $fileSize = filesize($file); $files[] = [ 'name' => substr($fileName, 1), 'time' => date("Y-m-d H:i:s", filemtime($file)), - 'size' => Base::readableBytes(filesize($file)), + 'size' => $fileSize > 0 ? Base::readableBytes($fileSize) : 0, 'url' => Base::fillUrl($path . $fileName), ]; } @@ -294,10 +295,11 @@ class IndexController extends InvokeController continue; } $fileName = Base::leftDelete($file, $dirPath); + $fileSize = filesize($file); $apkFile = [ 'name' => substr($fileName, 1), 'time' => date("Y-m-d H:i:s", filemtime($file)), - 'size' => Base::readableBytes(filesize($file)), + 'size' => $fileSize > 0 ? Base::readableBytes($fileSize) : 0, 'url' => Base::fillUrl($path . $fileName), ]; }