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.
 
Top Bottom