Normalise newlines in incoming emails
authorTom Hughes <tom@compton.nu>
Tue, 30 Jan 2018 00:27:01 +0000 (00:27 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 30 Jan 2018 00:27:01 +0000 (00:27 +0000)
Fixes #1708

script/deliver-message

index 46f9642..15a9fbd 100755 (executable)
@@ -25,7 +25,9 @@ exit 0 if date < 1.month.ago
 
 message.update(:message_read => true) if message
 
-mail = Mail.new(STDIN.readlines.join)
+mail = Mail.new(STDIN.read
+                     .encode(:universal_newline => true)
+                     .encode(:crlf_newline => true))
 
 message = Message.from_mail(mail, from, to)
 message.save!