N°6613 - Fix user picture pushing invalid data

This commit is contained in:
Benjamin Dalsass
2024-11-13 13:18:50 +01:00
parent e7488b2c89
commit e9f16935b6

View File

@@ -35,9 +35,6 @@ class PreferencesController extends AbstractController
{
$sImageFilename = utils::ReadPostedParam('image_filename', null, utils::ENUM_SANITIZATION_FILTER_RAW_DATA);
// Set preference for the user
appUserPreferences::SetPref('user_picture_placeholder', $sImageFilename);
$sUserPicturesFolder = 'images/user-pictures/';
$sImageAbsPath = utils::RealPath(APPROOT.$sUserPicturesFolder.$sImageFilename, APPROOT.$sUserPicturesFolder);
$sImageAbsUrl = utils::GetAbsoluteUrlAppRoot().$sUserPicturesFolder.$sImageFilename;
@@ -53,6 +50,9 @@ class PreferencesController extends AbstractController
throw new Exception('Error while updating user image, could not open file "'.$sImageAbsPath.'"');
}
// Set preference for the user
appUserPreferences::SetPref('user_picture_placeholder', $sImageFilename);
// Check if user has a contact with an image attribute, so we put the image in it also
$sPersonClass = 'Person';
if (true === MetaModel::HasImageAttributeCode($sPersonClass)) {