]> git.openstreetmap.org Git - rails.git/commitdiff
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 46f9642e7f60ea5bd9d2b7b16d6d5f7100149356..15a9fbdc7f613f7d14cb9b6119a6dc7719d39afc 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!