Fixed potential bugs

This commit is contained in:
Jan Böhmer 2026-05-11 23:25:21 +02:00
parent a6ef9a58ec
commit 3431320d03
4 changed files with 8 additions and 5 deletions

View file

@ -89,7 +89,7 @@ trait PKImportHelperTrait
//Use mime type to determine the extension like PartKeepr does in legacy implementation (just use the second part of the mime type)
//See UploadedFile.php:291 in PartKeepr (https://github.com/partkeepr/PartKeepr/blob/f6176c3354b24fa39ac8bc4328ee0df91de3d5b6/src/PartKeepr/UploadedFileBundle/Entity/UploadedFile.php#L291)
if (!empty ($attachment_row['mimetype'])) {
$attachment_row['extension'] = explode('/', (string) $attachment_row['mimetype'])[1];
$attachment_row['extension'] = explode('/', (string) $attachment_row['mimetype'])[1] ?? '';
} else {
//If the mime type is empty, we use the original extension
$attachment_row['extension'] = pathinfo((string) $attachment_row['originalname'], PATHINFO_EXTENSION);