mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-25 10:09:20 +03:00
Bugfix: MIME parser RegExp didn't escape boundary which caused issues
This commit is contained in:
parent
50569e1854
commit
7bc302c665
2 changed files with 8 additions and 1 deletions
|
|
@ -175,7 +175,7 @@ export function ParseMime(text)
|
||||||
let boundary = headers['content-type']?.params.boundary;
|
let boundary = headers['content-type']?.params.boundary;
|
||||||
if (boundary) {
|
if (boundary) {
|
||||||
part.boundary = boundary;
|
part.boundary = boundary;
|
||||||
let regex = new RegExp('(?:^|\r?\n)--' + boundary + '(?:--)?(?:\r?\n|$)', 'g'),
|
let regex = new RegExp('(?:^|\r?\n)--' + RegExp.escape(boundary) + '(?:--)?(?:\r?\n|$)', 'g'),
|
||||||
body = mimePart.slice(head.length),
|
body = mimePart.slice(head.length),
|
||||||
bodies = body.split(regex),
|
bodies = body.split(regex),
|
||||||
pos = part.bodyStart;
|
pos = part.bodyStart;
|
||||||
|
|
|
||||||
7
dev/prototype.js
vendored
7
dev/prototype.js
vendored
|
|
@ -44,6 +44,13 @@
|
||||||
return template.content.firstChild;
|
return template.content.firstChild;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://github.com/tc39/proposal-regex-escaping
|
||||||
|
*/
|
||||||
|
if (!RegExp.escape){
|
||||||
|
RegExp.escape = s => String(s).replace(/[\\^$*+?.()|[\]{}]/g, '\\$&');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Every time the function is executed,
|
* Every time the function is executed,
|
||||||
* it will delay the execution with the given amount of milliseconds.
|
* it will delay the execution with the given amount of milliseconds.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue