Skip to content

Commit

Permalink
Removing . and @ hack for Alexey to look at
Browse files Browse the repository at this point in the history
  • Loading branch information
mikel committed Nov 17, 2008
1 parent bed1cd9 commit cf4604e
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/tmail/address.rb
Expand Up @@ -81,7 +81,7 @@ class Address
#
# Raises a TMail::SyntaxError on invalid email format
def Address.parse( str )
Parser.parse :ADDRESS, special_quote_address(str)
Parser.parse :ADDRESS, (str)
end

def Address.special_quote_address(str) #:nodoc:
Expand Down Expand Up @@ -110,7 +110,7 @@ def Address.special_quote_address(str) #:nodoc:
return "\"#{$1}\" #{$2}"
# This handles cases where 'Mikel A. <mikel@me.com>' which is a trailing
# full stop before the address section. Just quotes it to
# '"Mikel A. <mikel@me.com>"
# '"Mikel A." <mikel@me.com>'
when str =~ /\A(.*?\.)\s(<.*?>)\Z/
return "\"#{$1}\" #{$2}"
else
Expand Down
14 changes: 14 additions & 0 deletions test/fixtures/raw_email_double_at_in_header
@@ -0,0 +1,14 @@
From jamis_buck@byu.edu Mon May 2 16:07:05 2005
Mime-Version: 1.0 (Apple Message framework v622)
Content-Transfer-Encoding: base64
Message-Id: <d3b8cf8e49f0448085@0c28713a1@f473e@37signals.com>
Content-Type: text/plain;
charset=EUC-KR;
format=flowed
To: willard15georgina@jamis.backpackit.com
From: Jamis Buck <jamis@37signals.com>
Subject: =?EUC-KR?Q?NOTE:_=C7=D1=B1=B9=B8=BB=B7=CE_=C7=CF=B4=C2_=B0=CD?=
Date: Mon, 2 May 2005 16:07:05 -0600

tOu6zrrQwMcguLbC+bChwfa3ziwgv+y4rrTCIMfPs6q01MC7ILnPvcC0z7TZLg0KDQrBpiDAzLin
wLogSmFtaXPA1LTPtNku
21 changes: 21 additions & 0 deletions test/fixtures/raw_email_trailing_dot
@@ -0,0 +1,21 @@
Delivered-To: xxx@xxx.com
Received: by 10.67.31.8 with SMTP id i8cs1195ugj;
Mon, 22 Sep 2008 13:45:18 -0700 (PDT)
Received: by 10.100.207.5 with SMTP id e5mr3483815ang.104.1222110393505;
Mon, 22 Sep 2008 12:06:33 -0700 (PDT)
Return-Path: <noreply@rubyforge.org>
Received: from rubyforge.org (rubyforge.org [205.234.109.19])
by mx.google.com with ESMTP id c2si899474ana.10.2008.09.22.12.06.28;
Mon, 22 Sep 2008 12:06:33 -0700 (PDT)
Received-SPF: pass (google.com: best guess record for domain of noreply@rubyforge.org designates 205.234.109.19 as permitted sender) client-ip=205.234.109.19;
Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of noreply@rubyforge.org designates 205.234.109.19 as permitted sender) smtp.mail=noreply@rubyforge.org
Received: by rubyforge.org (Postfix, from userid 502)
id 8FB1518581AC; Mon, 22 Sep 2008 15:06:28 -0400 (EDT)
To: noreply@rubyforge.org
From: Sandy M. <noreply@rubyforge.org>
Subject: [skynet-help][60666] How are intermediate files handled in SkyNet?
Content-type: text/plain; charset=UTF-8
Message-Id: <20080922190628.8FB1518581AC@rubyforge.org>
Date: Mon, 22 Sep 2008 15:06:28 -0400 (EDT)

Testing, testing, 123.
7 changes: 7 additions & 0 deletions test/test_address.rb
Expand Up @@ -1204,4 +1204,11 @@ def test_at_char_in_address()
:format => %Q(mikel <mikel@lindsaar.net>)
end

def test_trailing_dot_in_name
fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email_trailing_dot")
str = 'Sandy M. <noreply@rubyforge.org>'
mail = TMail::Mail.parse(fixture)
assert_equal str, mail.from
end

end

0 comments on commit cf4604e

Please sign in to comment.