maildev
maildev copied to clipboard
Fix crash when attachment with contentId containing /
When an email is rec ivied with a contentId
containing a slash /
it fail with
node:events:505
throw er; // Unhandled 'error' event
^
Error: ENOENT: no such file or directory, open '/tmp/maildev-244388/H7awAzl6/folder/image'
Emitted 'error' event on WriteStream instance at:
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/tmp/maildev-244388/H7awAzl6/folder/image'
}
I fixed it using encodeURIComponent
when reading or writing to disk.
I also include a test case.