Skip to content

Commit

Permalink
fix eml uploader to allow arbitrary preambles (#6565)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickkettner authored Feb 1, 2023
1 parent df1c26b commit 08b31da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Empty file added gitblah-o5en
Empty file.
11 changes: 7 additions & 4 deletions playground/src/email-loader/email-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,13 @@ class EmailLoader {

parseMultipartBody(body, boundary) {
const rawParts = body.split('--' + boundary);
if (
rawParts[0].trim() !== '' ||
rawParts[rawParts.length - 1].trim() !== '--'
) {

// See https://bit.ly/3wHQtDw
// by spec, you can have anything string before the first boundary.
// So we just dump everything before the first CLRF
rawParts[0] = '';

if (rawParts[rawParts.length - 1].trim() !== '--') {
throw new Error('Invalid multipart body');
}
const parts = rawParts.slice(1, -1);
Expand Down

0 comments on commit 08b31da

Please sign in to comment.