diff --git a/Classes/Controller/EditController.php b/Classes/Controller/EditController.php index 9b9cf4e59..fc82137b7 100644 --- a/Classes/Controller/EditController.php +++ b/Classes/Controller/EditController.php @@ -220,7 +220,7 @@ public function deleteAction(User $user) */ protected function redirectIfNoChangesOnObject(User $user) { - if (!ObjectUtility::isDirtyObject($user)) { + if (!ObjectUtility::isDirtyObject($user, $this->request)) { $this->addFlashMessage(LocalizationUtility::translate('noChanges'), '', ContextualFeedbackSeverity::NOTICE); return $this->redirect('edit'); } diff --git a/Classes/Utility/ObjectUtility.php b/Classes/Utility/ObjectUtility.php index d583556e2..bed5e9ddc 100644 --- a/Classes/Utility/ObjectUtility.php +++ b/Classes/Utility/ObjectUtility.php @@ -7,6 +7,7 @@ use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Database\Query\QueryBuilder; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Extbase\Mvc\RequestInterface; use TYPO3\CMS\Extbase\Persistence\ObjectStorage; use TYPO3\CMS\Extbase\Reflection\Exception\PropertyNotAccessibleException; use TYPO3\CMS\Extbase\Reflection\ObjectAccess; @@ -34,9 +35,10 @@ public static function getContentObject(): ContentObjectRenderer * Checks if object was changed or not * * @param object $object + * @param RequestInterface $request * @codeCoverageIgnore */ - public static function isDirtyObject($object): bool + public static function isDirtyObject($object, RequestInterface $request): bool { foreach (array_keys($object->_getProperties()) as $propertyName) { try { @@ -63,6 +65,15 @@ public static function isDirtyObject($object): bool return true; } } + + /** check if there is an uploaded image */ + $uploadedFiles = $request->getUploadedFiles(); + if ( + count($uploadedFiles) > 0 + && !empty($uploadedFiles['image']) + ) { + return true; + } } return false; }