Closed simonb83 closed 11 years ago
Thanks for your pull, this is not expected behavior. Fix is imminent.
Thanks! I don't know if this helps, but I narrowed this down to line 26 in email_parser.rb body.split(delimeter).first
which returns nil when body is empty.
In my testing changing the method to
def self.extract_reply_body(body) if body && !body.empty?
works pretty nicely.
Thanks again.
I have successfully integrated Griddler into my app, and it works perfectly as long as the email body has some text in it.
However when I test with an email with an empty body, I keep on getting the following error from the email_parser (which looks to be because the body is empty):
NoMethodError (undefined method
split' for nil:NilClass): griddler (0.3.1) lib/griddler/email_parser.rb:26:inextract_reply_body' griddler (0.3.1) lib/griddler/email.rb:63:in
extract_body' griddler (0.3.1) lib/griddler/email.rb:12:ininitialize' griddler (0.3.1) app/controllers/griddler/emails_controller.rb:3:in
new' griddler (0.3.1) app/controllers/griddler/emails_controller.rb:3:increate'
--Edit--
After some investigating, this appears to be happening because of the way the format is set in the params in the incoming email. Specifically, when the email body has content, in the params the format is set as
"text"=>"String\n"
, however when the body is empty, this becomes"text"=>""
.This would seem to be the root cause, because in my rspec tests,
post :create, to: "email-token", from: "user@email.com", text: "some string"
passes, butpost :create, to: "email-token", from: "user@email.com", text: ""
fails.