commit bbd6550143110c719aeacc0d902fe1f22502e392
parent 568802736e8698f1eb126b7d501c273b878b2bb8
Author: Hamish Downer <dmishd@gmail.com>
Date: Sun, 17 Oct 2010 19:48:36 +0100
Deal with "\r\n" inside encrypted messages
RMail expects "\n\n" to be the dividing line between the header and
body, but sometimes the decrypted message has "\r\n" as line ending
so the RMail parsing does not work. This commit fixes that.
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/lib/sup/crypto.rb b/lib/sup/crypto.rb
@@ -170,6 +170,10 @@ EOS
end
msg.body = output
else
+ # It appears that some clients use Windows new lines - CRLF - but RMail
+ # splits the body and header on "\n\n". So to allow the parse below to
+ # succeed, we will convert the newlines to what RMail expects
+ output = output.gsub(/\r\n/, "\n")
# This is gross. This decrypted payload could very well be a multipart
# element itself, as opposed to a simple payload. For example, a
# multipart/signed element, like those generated by Mutt when encrypting