Keep correct file extension for audio captures (voice chat) (#8687)

Problem:
When audio is directly recorded to chat, it has the correct file extension in its name ("audio.mp3"). The file object we get doesn't have an extension property though, so the file name after our modification would be "audio.mp3.undefined". Safari doesn't accept this as audio source, and I hate to say it, but I agree.

So if there is no extension, keep the existing one. Problem solved.
This commit is contained in:
Max 2025-06-19 13:03:22 +02:00 committed by GitHub
parent d656ac00a1
commit 915091286a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -376,7 +376,11 @@ export default {
const filesToUpload = hasFiles
? files.map((file) => ({
upload: new File([file.blob], `${file.name}.${file.extension}`),
upload: new File(
[file.blob],
// Captured audio already has the right extension in the name
file.extension ? `${file.name}.${file.extension}` : file.name,
),
name: file.name,
type: file.type,
}))