web/libav: accept canonical extension if blob is a file

This commit is contained in:
jj 2025-01-25 20:13:19 +00:00
parent c5e7b29c6c
commit 75cda47633
No known key found for this signature in database
2 changed files with 8 additions and 3 deletions

View file

@ -56,9 +56,14 @@ export default class LibAVWrapper {
}
}
static getExtensionFromType(blob: Blob) {
static getExtensionFromType(blob: Blob | File) {
const canonicalExtension = blob instanceof File && blob.name.split('.').pop()?.toLowerCase();
const extensions = mime.getAllExtensions(blob.type);
const overrides = ['mp3', 'mov'];
if (canonicalExtension && extensions?.has(canonicalExtension))
return canonicalExtension;
const overrides = ['mp3', 'mov', 'opus'];
if (!extensions)
return;

View file

@ -7,7 +7,7 @@ export type FileInfo = {
}
export type RenderParams = {
blob: Blob,
blob: Blob | File,
output?: FileInfo,
args: string[],
}