Made regex quantifier lazy to resolve #381 (#1349)

Co-authored-by: Your Name <you@example.com>
This commit is contained in:
Balearica 2024-01-02 03:00:22 -08:00 committed by GitHub
parent ebf404e4ae
commit 2d5b4160ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -16,7 +16,7 @@ class PDFImage {
data = Buffer.from(new Uint8Array(src));
} else {
let match;
if ((match = /^data:.+;base64,(.*)$/.exec(src))) {
if ((match = /^data:.+?;base64,(.*)$/.exec(src))) {
data = Buffer.from(match[1], 'base64');
} else {
data = fs.readFileSync(src);

View File

@ -32,7 +32,7 @@ export default {
data = Buffer.from(new Uint8Array(src));
} else {
let match;
if ((match = /^data:(.*);base64,(.*)$/.exec(src))) {
if ((match = /^data:(.*?);base64,(.*)$/.exec(src))) {
if (match[1]) {
refBody.Subtype = match[1].replace('/', '#2F');
}