| ... | ... | @@ -101,14 +101,12 @@ function parseBase64DataUrl( |
| 101 | 101 | dataUrl: string, |
| 102 | 102 | ): { readonly mimeType: string; readonly base64: string } | null { |
| 103 | 103 | const match = /^data:([^;,]+);base64,([a-z0-9+/=\r\n]+)$/i.exec(dataUrl.trim()); |
| 104 | | if (!match) { |
| 105 | | return null; |
| 106 | | } |
| 104 | if (!match) return null; |
| 105 | |
| 107 | 106 | const mimeType = match[1]?.trim().toLowerCase(); |
| 108 | 107 | const base64 = match[2]?.replace(/\s+/g, ""); |
| 109 | | if (!mimeType || !base64) { |
| 110 | | return null; |
| 111 | | } |
| 108 | if (!mimeType || !base64) return null; |
| 109 | |
| 112 | 110 | return { mimeType, base64 }; |
| 113 | 111 | } |
| 114 | 112 | |