Skip to content

Commit 7090355

Browse files
committed
Unicode characters like 4-byte emojis caused errors when used in attachment filenames
1 parent 26eaeb8 commit 7090355

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"main": "dist/builder",
2424
"dependencies": {
2525
"emailjs-addressparser": "^2.0.2",
26-
"emailjs-mime-codec": "^2.0.5",
26+
"emailjs-mime-codec": "^2.0.8",
2727
"emailjs-mime-types": "^2.0.0",
2828
"punycode": "1.4.1",
2929
"ramda": "^0.25.0"

src/builder-unit.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,12 @@ describe('Mimebuilder', function () {
403403
expect(/^Content-Disposition: attachment; filename\*0\*=utf-8''j%C3%B5geva.txt$/m.test(msg)).to.be.true
404404
})
405405

406+
it('should set filename with a smiley without throwing URIError: URI malformed', function () {
407+
expect(() => new Mimebuilder('text/plain', {
408+
filename: 'Emoji-😊.png'
409+
}).build()).to.not.throw()
410+
})
411+
406412
it('should detect content type from filename', function () {
407413
const msg = new Mimebuilder(false, {
408414
filename: 'jogeva.zip'

0 commit comments

Comments
 (0)