Private
Public Access
1
0

Compare commits

...

2 Commits

Author SHA1 Message Date
5d6aff8d90 chg: dev: the user's avatar will be saved as a uuid.extension #4
All checks were successful
Deploy to Production / deploy (push) Successful in 10s
2026-04-14 16:53:16 +02:00
15ba26ccf2 chg: pkg: new version release !skipChangelog
All checks were successful
Deploy to Production / deploy (push) Successful in 3s
2026-04-14 16:47:15 +02:00
2 changed files with 6 additions and 7 deletions

View File

@@ -216,7 +216,7 @@ POSTGRES_VERSION=18
MINIO_ROOT_USER=mineseeker MINIO_ROOT_USER=mineseeker
MINIO_ROOT_PASSWORD="<strong password>" MINIO_ROOT_PASSWORD="<strong password>"
MINIO_ENDPOINT=http://minio:9000 MINIO_ENDPOINT=http://minio:9000
MINIO_PUBLIC_URL=https://minio.mineseeker.hu MINIO_PUBLIC_URL=https://aws.mineseeker.hu
MAILER_DSN=smtp://mail:25?verify_peer=0 MAILER_DSN=smtp://mail:25?verify_peer=0
MAIL_DOMAIN=mineseeker.hu MAIL_DOMAIN=mineseeker.hu

View File

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