commit 70ab511c171700bc435978eb505d15022ee91084
parent 692cd5119c0cd2d1455577c3e61eba27a3de89b2
Author: William Morgan <wmorgan-sup@masanjin.net>
Date: Mon, 19 May 2008 14:11:11 -0700
bugfix: gpg signing failures because when no trailing newlines
when :edit_signature was false, and a non-empty signature file was used,
message bodies didn't end in a newline. for some reason GPG produces
signature output that assumes a trailing newline, even if you don't
have one.
so, now we force one if it ain't there.
Diffstat:
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/sup/crypto.rb b/lib/sup/crypto.rb
@@ -150,6 +150,8 @@ private
["Can't find gpg binary in path."]
end
+ ## here's where we munge rmail output into the format that signed/encrypted
+ ## PGP/GPG messages should be
def format_payload payload
payload.to_s.gsub(/(^|[^\r])\n/, "\\1\r\n").gsub(/^MIME-Version: .*\r\n/, "")
end
diff --git a/lib/sup/modes/edit-message-mode.rb b/lib/sup/modes/edit-message-mode.rb
@@ -305,8 +305,9 @@ protected
m = RMail::Message.new
m.header["Content-Type"] = "text/plain; charset=#{$encoding}"
m.body = @body.join
- m.body = m.body
m.body += sig_lines.join("\n") unless $config[:edit_signature]
+ ## body must end in a newline or GPG signatures will be WRONG!
+ m.body += "\n" unless m.body =~ /\n\Z/
## there are attachments, so wrap body in an attachment of its own
unless @attachments.empty?