Skip to content

Commit

Permalink
accept spaces in RFC2047-encoded headers
Browse files Browse the repository at this point in the history
The RFC says spaces must not appear in encoded words but we can accept
and decode them.

Fixes sup-heliotrope#424.
  • Loading branch information
danc86 committed Jul 19, 2020
1 parent cf21f61 commit 8c69271
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/sup/rfc2047.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/rfc2047-header-encoding.eml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ From: [email protected]
To: [email protected]
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?=

Expand Down

0 comments on commit 8c69271

Please sign in to comment.