Skip to content

Commit

Permalink
[BUGFIX] Fix UIDs for files depending on class implementing FileInter…
Browse files Browse the repository at this point in the history
…face
  • Loading branch information
dvdmlln committed Aug 15, 2024
1 parent a2bd9a5 commit c5da2be
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions Classes/Utility/FileUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
use TYPO3\CMS\Core\Configuration\Features;
use TYPO3\CMS\Core\Http\NormalizedParams;
use TYPO3\CMS\Core\Imaging\ImageManipulation\CropVariantCollection;
use TYPO3\CMS\Core\Resource\File;
use TYPO3\CMS\Core\Resource\FileInterface;
use TYPO3\CMS\Core\Resource\FileReference;
use TYPO3\CMS\Core\Resource\ProcessedFile;
use TYPO3\CMS\Core\Resource\Rendering\RendererRegistry;
use TYPO3\CMS\Core\Utility\ArrayUtility;
Expand Down Expand Up @@ -65,8 +67,8 @@ public function process(FileInterface $fileReference, ProcessingConfiguration $p
{
$originalFileReference = clone $fileReference;
$originalFileUrl = $fileReference->getPublicUrl();
$fileReferenceUid = $fileReference->getUid();
$uidLocal = $fileReference->getProperty('uid_local');
$fileReferenceUid = $fileReference instanceof FileReference ? $fileReference->getUid() : null;
$uidLocal = $fileReference instanceof File ? $fileReference->getUid() : $fileReference->getProperty('uid_local');
$fileRenderer = $this->rendererRegistry->getRenderer($fileReference);
$crop = $fileReference->getProperty('crop');
$link = $fileReference->getProperty('link');
Expand Down
8 changes: 4 additions & 4 deletions Tests/Unit/Utility/FileUtilityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ public function testCustomProcessingOptions(): void
'type' => 'image',
'filename' => 'test-file.jpg',
'originalUrl' => '/fileadmin/test-file.jpg',
'uidLocal' => null,
'fileReferenceUid' => 103,
'uidLocal' => 103,
'fileReferenceUid' => null,
'size' => '71 KB',
'dimensions' =>
[
Expand Down Expand Up @@ -672,8 +672,8 @@ protected function getBaselineResultArrayForFile(): array
'type' => 'image',
'filename' => 'test-file.jpg',
'originalUrl' => '/fileadmin/test-file.jpg',
'uidLocal' => null,
'fileReferenceUid' => 103,
'uidLocal' => 103,
'fileReferenceUid' => null,
'size' => '71 KB',
'dimensions' =>
[
Expand Down

0 comments on commit c5da2be

Please sign in to comment.