Skip to content

Commit

Permalink
Made regex quantifier lazy to resolve #381 (#1349)
Browse files Browse the repository at this point in the history
Co-authored-by: Your Name <[email protected]>
  • Loading branch information
Balearica and Your Name authored Jan 2, 2024
1 parent ebf404e commit 2d5b416
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/mixins/attachments.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down

0 comments on commit 2d5b416

Please sign in to comment.