Canonical repo for Dong Web (dong.vielle.dev)

fix mime type validation

Changed files
+8 -5
src
+8 -5
src/dong-io.ts
··· 30 30 image: File, 31 31 audio: File 32 32 ): Promise<Blob | string> => { 33 - if (image.type === "" || audio.type === "") return "Mime types invalid"; 33 + if ( 34 + image.type === "" || 35 + !image.type.startsWith("image/") || 36 + audio.type === "" || 37 + !audio.type.startsWith("audio/") 38 + ) 39 + return "Mime types invalid"; 34 40 return new Blob([ 35 41 // version 36 42 (() => { ··· 66 72 ]); 67 73 }; 68 74 69 - export async function readDong( 70 - dongFile: File, 71 - 72 - ): Promise< 75 + export async function readDong(dongFile: File): Promise< 73 76 | { 74 77 image: { data: Uint8Array; b64?: string; mime: string }; 75 78 audio: { data: Uint8Array; b64?: string; mime: string };