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

NullPointerException when no file name in attachment #75

Open
arichiardi opened this issue Jun 10, 2016 · 2 comments
Open

NullPointerException when no file name in attachment #75

arichiardi opened this issue Jun 10, 2016 · 2 comments

Comments

@arichiardi
Copy link

Dear Drew, I am using successfully your library for building an email and I found out today while creating

{:type :attachment
 :content-type (email-impl/guess-mime "http://lorempixel.com/400/200/" "image/jpeg")
 :content (io/as-url "http://lorempixel.com/400/200/")}

Throws a NPE:

java.lang.NullPointerException
    at javax.mail.internet.MimeUtility.quote(MimeUtility.java:927) ~[mailapi-1.4.3.jar:1.4.3]
    at javax.mail.internet.ParameterList.quote(ParameterList.java:649) ~[mailapi-1.4.3.jar:1.4.3]
    at javax.mail.internet.ParameterList.access$200(ParameterList.java:71) ~[mailapi-1.4.3.jar:1.4.3]
    at javax.mail.internet.ParameterList$ToStringBuffer.addNV(ParameterList.java:617) ~[mailapi-1.4.3.jar:1.4.3]
    at javax.mail.internet.ParameterList.toString(ParameterList.java:598) ~[mailapi-1.4.3.jar:1.4.3]
    at javax.mail.internet.ContentDisposition.toString(ContentDisposition.java:185) ~[mailapi-1.4.3.jar:1.4.3]
    at javax.mail.internet.MimeBodyPart.setFileName(MimeBodyPart.java:1161) ~[mailapi-1.4.3.jar:1.4.3]
    at javax.mail.internet.MimeBodyPart.setFileName(MimeBodyPart.java:531) ~[mailapi-1.4.3.jar:1.4.3]
    at postal.message$eval_bodypart.invokeStatic(message.clj:108) ~[?:?]
    at postal.message$eval_bodypart.invoke(message.clj:104) ~[?:?]
    at postal.message$eval54499$fn__54500.invoke(message.clj:98) ~[?:?]
    at postal.message$eval54482$fn__54483$G__54473__54488.invoke(message.clj:94) ~[?:?]
    at postal.message$eval_multipart.invokeStatic(message.clj:137) ~[?:?]
    at postal.message$eval_multipart.invoke(message.clj:127) ~[?:?]
    at postal.message$add_multipart_BANG_.invokeStatic(message.clj:141) ~[?:?]
    at postal.message$add_multipart_BANG_.invoke(message.clj:140) ~[?:?]
    at postal.message$add_body_BANG_.invokeStatic(message.clj:151) ~[?:?]
    at postal.message$add_body_BANG_.invoke(message.clj:148) ~[?:?]
    at postal.message$make_jmessage.invokeStatic(message.clj:177) ~[?:?]
    at postal.message$make_jmessage.invoke(message.clj:157) ~[?:?]
    at postal.message$make_jmessage.invokeStatic(message.clj:166) ~[?:?]
    at postal.message$make_jmessage.invoke(message.clj:157) ~[?:?]

I check the source and it fails here because re-find returns nil. Probably a simple dummy file name would avoid this issue right?

Thanks!

drewr added a commit that referenced this issue Jun 14, 2016
@drewr
Copy link
Owner

drewr commented Jun 14, 2016

This is definitely some lame code. We need to decide what to do with paths that don't really have a "filename." I'd like to either use (:file-name part) or a UUID. See proposed patch 👇 .

drewr added a commit that referenced this issue Jun 14, 2016
@arichiardi
Copy link
Author

arichiardi commented Jun 14, 2016

Yes that looks great! 😄 If it is up somewhere I will try asap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants