web/libav: accept canonical extension if blob is a file
Some checks failed
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Has been cancelled
Run tests / check lockfile correctness (push) Has been cancelled
Run tests / web sanity check (push) Has been cancelled
Run tests / api sanity check (push) Has been cancelled

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 extensions = mime.getAllExtensions(blob.type);
const overrides = ['mp3', 'mov'];
if (canonicalExtension && extensions?.has(canonicalExtension))
return canonicalExtension;
const overrides = ['mp3', 'mov', 'opus'];
if (!extensions) if (!extensions)
return; return;

View file

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