🖼️ feat: Avatar GIF Support & Dynamic Extensions (#7657)

This commit is contained in:
Marco Beretta 2025-06-02 13:51:38 +02:00 committed by GitHub
parent aca89091d9
commit 442b149d55
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 58 additions and 10 deletions

View file

@ -129,7 +129,10 @@ async function processLocalAvatar({ buffer, userId, manual }) {
userId,
);
const fileName = `avatar-${new Date().getTime()}.png`;
const metadata = await sharp(buffer).metadata();
const extension = metadata.format === 'gif' ? 'gif' : 'png';
const fileName = `avatar-${new Date().getTime()}.${extension}`;
const urlRoute = `/images/${userId}/${fileName}`;
const avatarPath = path.join(userDir, fileName);