Fixed Useless write in \XF\Service\User\Avatar::updateAvatar

Kirby

Well-known member
Affected version
2.2.7 PL 1
Not a big issue, but seems useless anyway:

PHP:
if ($shortSide > $origSize)
{
    [...]
}
else
{
    $outputFiles['o'] = $this->fileName;
    [...]
}

[...]

foreach ($this->sizeMap AS $code => $size)
{
    if (isset($outputFiles[$code]))
    {
        continue;
    }
    
    [...]
}

[...]

foreach ($outputFiles AS $code => $file)
{
    $dataFile = $this->user->getAbstractedCustomAvatarPath($code);
    XF\Util\File::copyFileToAbstractedPath($file, $dataFile);
}

If this code path is executed on an existing avatar (which does happen if the user selects a different crop), the o image does get overwritten although it is not modified at all.
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.3.8).

Change log:
Avoid unnecessary write of original avatar when only crop changes
There may be a delay before changes are rolled out to the XenForo Community.
 
Back
Top Bottom