sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 04b6fa5bb629c63fad2a3741bbf5ade06014ba5b
parent b1a3e7f8f16d375192ae59b0c1ddf65fb901fe9e
Author: Dan Callaghan <djc@djc.id.au>
Date:   Sun, 19 Jul 2020 17:35:20 +1000

accept spaces in RFC2047-encoded headers

The RFC says spaces must not appear in encoded words but we can accept
and decode them.

Fixes #424.

Diffstat:
M lib/sup/rfc2047.rb | 2 +-
M test/fixtures/rfc2047-header-encoding.eml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/sup/rfc2047.rb b/lib/sup/rfc2047.rb
@@ -17,7 +17,7 @@
 # This file is distributed under the same terms as Ruby.
 
 module Rfc2047
-  WORD = %r{=\?([!\#$%&'*+-/0-9A-Z\\^\`a-z{|}~]+)\?([BbQq])\?([!->@-~]+)\?=} # :nodoc: 'stupid ruby-mode
+  WORD = %r{=\?([!\#$%&'*+-/0-9A-Z\\^\`a-z{|}~]+)\?([BbQq])\?([!->@-~ ]+)\?=} # :nodoc: 'stupid ruby-mode
   WORDSEQ = %r{(#{WORD.source})\s+(?=#{WORD.source})}
 
   def Rfc2047.is_encoded? s; s =~ WORD end
diff --git a/test/fixtures/rfc2047-header-encoding.eml b/test/fixtures/rfc2047-header-encoding.eml
@@ -2,7 +2,7 @@ From: test@example.invalid
 To: test@example.invalid
 Date: Sun, 19 Jul 2020 17:03:56 +1000
 Subject:
- =?US-ASCII?q?Hans_Martin_Djupvik?= =?ISO-8859-1?q?,_Ingrid_B=F8?=
+ =?US-ASCII?q?Hans Martin Djupvik?= =?ISO-8859-1?q?,_Ingrid_B=F8?=
  =?KOI8-R?b?LCDp0snOwSDzycTP0s/XwQ?=
  =?UTF-16?b?//4sACAASgBlAHMAcABlAHIAIABCAGUAcgBnAA?=