Skip to content

Commit

Permalink
[BUGFIX] Use proper path to get size of used files in admin panel
Browse files Browse the repository at this point in the history
The path of the used files must be adopted to get the file size.

Resolves: #100846
Releases: main, 12.4
Change-Id: I7ef635b2af5add448ed908d9c2c9ef3d61c95527
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/79241
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
  • Loading branch information
georgringer authored and lolli42 committed Jun 8, 2023
1 parent 06b46e2 commit 92d8483
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -23,6 +23,7 @@
use TYPO3\CMS\Adminpanel\ModuleApi\ModuleData;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Context\UserAspect;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Page\AssetCollector;
use TYPO3\CMS\Core\TimeTracker\TimeTracker;
use TYPO3\CMS\Core\Utility\GeneralUtility;
Expand Down Expand Up @@ -121,7 +122,8 @@ protected function collectImagesOnPage(): array
$count = 0;
$totalImageSize = 0;
foreach (GeneralUtility::makeInstance(AssetCollector::class)->getMedia() as $file => $information) {
$fileSize = (int)@filesize($file);
$filePath = Environment::getPublicPath() . '/' . ltrim(parse_url($file, PHP_URL_PATH), '/');
$fileSize = is_file($filePath) ? filesize($filePath) : 0;
$imagesOnPage['files'][] = [
'name' => $file,
'size' => $fileSize,
Expand Down

0 comments on commit 92d8483

Please sign in to comment.