From 06ee81c15b7cafa08ca4c075152541cdef578e3e Mon Sep 17 00:00:00 2001 From: Max Frerichs Date: Tue, 20 Dec 2022 17:41:50 +0100 Subject: [PATCH 1/2] [BUGFIX]: Disable image processing for unsupported file types Some CTypes (e.g. uploads) have the option to enable thumbnails. This works for most file types for images and PDFs, but not for Microsoft-related file types (e.g. .docx). When using this extension on a site that has content elements (e.g file links with enabled thumbnails) with file types like mentioned above, an exception will occur, as there is no image to be processed. Simply disabling deferred image processing for this unsupported file types should fix this. --- Classes/Resource/Processing/DeferredImageProcessor.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Classes/Resource/Processing/DeferredImageProcessor.php b/Classes/Resource/Processing/DeferredImageProcessor.php index 2f89ce9..7de2a4c 100644 --- a/Classes/Resource/Processing/DeferredImageProcessor.php +++ b/Classes/Resource/Processing/DeferredImageProcessor.php @@ -19,7 +19,11 @@ public function canProcessTask(TaskInterface $task): bool && $task->getSourceFile()->getMimeType() !== 'image/svg+xml' && $task->getSourceFile()->getExtension() !== 'svg' && $task->getSourceFile()->getMimeType() !== 'application/pdf' - && $task->getSourceFile()->getExtension() !== 'pdf'; + && $task->getSourceFile()->getExtension() !== 'pdf' + && $task->getSourceFile()->getMimeType() !== 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' + && $task->getSourceFile()->getExtension() !== 'docx' + && $task->getSourceFile()->getMimeType() !== 'application/vnd.openxmlformats-officedocument.presentationml.presentation' + && $task->getSourceFile()->getExtension() !== 'pptx'; } public function processTask(TaskInterface $task): void From 0fdb20614018af7dfa270575dee466f1e16fcb61 Mon Sep 17 00:00:00 2001 From: Max Frerichs Date: Tue, 20 Dec 2022 17:41:50 +0100 Subject: [PATCH 2/2] [BUGFIX]: Disable image processing for unsupported file types Some CTypes (e.g. uploads) have the option to enable thumbnails. This works for most file types for images and PDFs, but not for Microsoft-related file types (e.g. .docx). When using this extension on a site that has content elements (e.g file links with enabled thumbnails) with file types like mentioned above, an exception will occur, as there is no image to be processed. Simply disabling deferred image processing for this unsupported file types should fix this. --- Classes/Resource/Processing/DeferredImageProcessor.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Classes/Resource/Processing/DeferredImageProcessor.php b/Classes/Resource/Processing/DeferredImageProcessor.php index 7de2a4c..7634789 100644 --- a/Classes/Resource/Processing/DeferredImageProcessor.php +++ b/Classes/Resource/Processing/DeferredImageProcessor.php @@ -20,8 +20,16 @@ public function canProcessTask(TaskInterface $task): bool && $task->getSourceFile()->getExtension() !== 'svg' && $task->getSourceFile()->getMimeType() !== 'application/pdf' && $task->getSourceFile()->getExtension() !== 'pdf' + && $task->getSourceFile()->getMimeType() !== 'application/msword' + && $task->getSourceFile()->getExtension() !== 'doc' && $task->getSourceFile()->getMimeType() !== 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' && $task->getSourceFile()->getExtension() !== 'docx' + && $task->getSourceFile()->getMimeType() !== 'application/application/vnd.ms-excel' + && $task->getSourceFile()->getExtension() !== 'xls' + && $task->getSourceFile()->getMimeType() !== 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' + && $task->getSourceFile()->getExtension() !== 'xlsx' + && $task->getSourceFile()->getMimeType() !== 'application/vnd.ms-powerpoint' + && $task->getSourceFile()->getExtension() !== 'ppt' && $task->getSourceFile()->getMimeType() !== 'application/vnd.openxmlformats-officedocument.presentationml.presentation' && $task->getSourceFile()->getExtension() !== 'pptx'; }