Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
8d9e872
1
Parent(s):
d68a5c3
fix fatal mistake in the b64 detector
Browse files
src/core/base64/extractBase64.mts
CHANGED
@@ -15,9 +15,7 @@ export function extractBase64(base64: string = ""): {
|
|
15 |
} {
|
16 |
// console.log(`extractBase64(${base64.slice(0, 120)})`)
|
17 |
// Regular expression to extract the MIME type and the base64 data
|
18 |
-
const matches = base64.match(/^data:([A-Za-z
|
19 |
-
|
20 |
-
// console.log("matches:", matches)
|
21 |
|
22 |
if (!matches || matches.length !== 3) {
|
23 |
throw new Error("Invalid base64 string")
|
|
|
15 |
} {
|
16 |
// console.log(`extractBase64(${base64.slice(0, 120)})`)
|
17 |
// Regular expression to extract the MIME type and the base64 data
|
18 |
+
const matches = base64.match(/^data:([A-Za-z-+0-9/]+);base64,(.+)$/)
|
|
|
|
|
19 |
|
20 |
if (!matches || matches.length !== 3) {
|
21 |
throw new Error("Invalid base64 string")
|