Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Space in filename causes error when using mime-mail-ses #54

Open
reite opened this issue Mar 25, 2018 · 5 comments · May be fixed by #68
Open

Space in filename causes error when using mime-mail-ses #54

reite opened this issue Mar 25, 2018 · 5 comments · May be fixed by #68
Labels
PR welcome Feature request is accepted and waiting for realization.

Comments

@reite
Copy link

reite commented Mar 25, 2018

When sending an email with an attachment with the filename "test hello.txt" I get the error:

*** Exception: SESException {seStatus = Status {statusCode = 400, statusMessage = "Bad Request"}, seCode = "InvalidParameterValue", seMessage = "Expected ';', got \"hello.txt\"", seRequestId = "a5b13731-300e-11e8-9a7a-a3641b570f3f"}

This is probably because the filename is not quoted when rendering the email. When I quote the filename myself "\"test hello.txt \"" it works.

I think it would make sense to quote the filename when rendering the mail. I can send a pull request if you agree?

@snoyberg
Copy link
Owner

snoyberg commented Mar 25, 2018 via email

@reite
Copy link
Author

reite commented Mar 25, 2018

To mime-mail. On this line:

Just fn ->
(:) ("Content-Disposition", "attachment; filename="
`T.append` fn))

Replacing fn with T.intercalate fn ["\"", "\""] would do it. However if someone is already quoting their file names this would cause issues, but I dont see any way around that without extra complexity.

I did some research on this and according to rfc2616 19.5.1 filenames should be quoted. However this spec is outdated and in the newer spec rfc6266 quoting is optional. So this is probably a bug in amazons parser.

So I'm not sure if it makes sense to make this change if its only a problem for amazon.

@snoyberg
Copy link
Owner

CCing @danchoi about changes to mime-mail itself.

@spencerjanssen
Copy link

So I'm not sure if it makes sense to make this change if its only a problem for amazon.

I've had some reports of issues with AOL.com email where filenames like One Two.pdf are interpreted as One, ie. everything after the first space is lost.

Would you like a pull request to quote attachment filenames?

@snoyberg
Copy link
Owner

I'd be open to such a PR.

@kindaro kindaro added the PR welcome Feature request is accepted and waiting for realization. label Sep 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR welcome Feature request is accepted and waiting for realization.
Projects
None yet
4 participants