Compare commits
1 Commits
v2026.2.0-
...
v2026.2.0-
| Author | SHA1 | Date | |
|---|---|---|---|
| 5d6aff8d90 |
@@ -19,6 +19,7 @@ use Liip\ImagineBundle\Imagine\Cache\CacheManager;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -228,16 +229,14 @@ class ProfileController extends AbstractController
|
||||
}
|
||||
|
||||
$ext = $file->guessExtension() ?? 'jpg';
|
||||
$newPath = sprintf('avatar/%d.%s', $user->getId(), $ext);
|
||||
$newPath = sprintf('avatar/%s.%s', Uuid::v4()->toRfc4122(), $ext);
|
||||
$oldPath = $user->getAvatarPath();
|
||||
|
||||
// Remove old file and any cached thumbnails
|
||||
if ($oldPath) {
|
||||
if ($oldPath !== $newPath) {
|
||||
try {
|
||||
$mediaStorage->delete($oldPath);
|
||||
} catch (\Throwable) {
|
||||
}
|
||||
try {
|
||||
$mediaStorage->delete($oldPath);
|
||||
} catch (\Throwable) {
|
||||
}
|
||||
$cacheManager->remove($oldPath, 'avatar_thumb');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user