Skip to content
Snippets Groups Projects
Commit 2c6f6fa5 authored by Benni Mack's avatar Benni Mack
Browse files

[BUGFIX] Avoid creation of duplicate processed files

Processed images are built based on a processing configuration,
which could contain values for width/height and other properties
which are integers (like width: 250, but width: 250c is also allowed).

Pure numeric (int) values are converted to real integers so the processing
configuration is always the same when querying the database for
existing processed files.

Resolves: #80942
Releases: master, 9.5
Change-Id: Ie72b3ebfe126e3ffbc7bc856e4ed03069c48fbd7
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62912


Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: default avatarSusanne Moog <look@susi.dev>
Tested-by: default avatarTobi Kretschmann <tobi@tobishome.de>
Tested-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarTobi Kretschmann <tobi@tobishome.de>
Reviewed-by: default avatarSusanne Moog <look@susi.dev>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
parent a48aaeb4
Branches
Tags
No related merge requests found
......@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Core\Resource\Service;
use Psr\EventDispatcher\EventDispatcherInterface;
use TYPO3\CMS\Core\Resource;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
/**
* File processing service
......@@ -81,6 +82,13 @@ class FileProcessingService
if ($taskType === Resource\ProcessedFile::CONTEXT_IMAGEPREVIEW) {
$configuration = Resource\Processing\LocalPreviewHelper::preProcessConfiguration($configuration);
}
// Ensure that the processing configuration which is part of the hash sum is properly cast, so
// unnecessary duplicate images are not produced, see #80942
foreach ($configuration as &$value) {
if (MathUtility::canBeInterpretedAsInteger($value)) {
$value = (int)$value;
}
}
/** @var Resource\ProcessedFileRepository $processedFileRepository */
$processedFileRepository = GeneralUtility::makeInstance(Resource\ProcessedFileRepository::class);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment