Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
* [sup-devel] [PATCH] Bugfix: Correctly split list of mail addresses
@ 2010-10-12 16:15 Gregor Hoffleit
  2010-10-14  1:10 ` Rich Lane
  0 siblings, 1 reply; 2+ messages in thread
From: Gregor Hoffleit @ 2010-10-12 16:15 UTC (permalink / raw)
  To: sup-devel

[-- Attachment #1: Type: text/plain, Size: 496 bytes --]

From the commit message:

    split_on_commas() fails to work correctly for wrapped header lines:

	Cc: John Doe <john.doe@subdivision.example.com>, Foo Bar
	    <foo.bar@subdivision.example.com>

    Sup parsed this (in lib/sup/person.rb, Person.from_address_list) as:

	Cc: John Doe <john.doe@subdivision.example.com>,
	    foo.bar <foo.bar@subdivision.example.com>

    I fixed this by normalizing the whitespace before working the
    regex in split_on_commas.


Regards,
    Gregor Hoffleit

[-- Attachment #2: 0005-Bugfix-Correctly-split-list-of-mail-addresses.patch --]
[-- Type: application/octet-stream, Size: 1260 bytes --]

From 3f267313c4116b75ee7de598820b202f9d1ade68 Mon Sep 17 00:00:00 2001
From: Gregor Hoffleit <gregor@sam.mediasupervision.de>
Date: Tue, 12 Oct 2010 18:04:37 +0200
Subject: [PATCH] Bugfix: Correctly split list of mail addresses

split_on_commas() fails to work correctly for wrapped header lines:

    Cc: John Doe <john.doe@subdivision.example.com>, Foo Bar
	<foo.bar@subdivision.example.com>

Sup parsed this (in lib/sup/person.rb, Person.from_address_list) as:

    Cc: John Doe <john.doe@subdivision.example.com>,
        foo.bar <foo.bar@subdivision.example.com>

I fixed this by normalizing the whitespace before working the
regex in split_on_commas.
---
 lib/sup/util.rb |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/sup/util.rb b/lib/sup/util.rb
index d19caca..53b7bac 100644
--- a/lib/sup/util.rb
+++ b/lib/sup/util.rb
@@ -224,7 +224,7 @@ class String
   ## a very complicated regex found on teh internets to split on
   ## commas, unless they occurr within double quotes.
   def split_on_commas
-    split(/,\s*(?=(?:[^"]*"[^"]*")*(?![^"]*"))/)
+    normalize_whitespace().split(/,\s*(?=(?:[^"]*"[^"]*")*(?![^"]*"))/)
   end
 
   ## ok, here we do it the hard way. got to have a remainder for purposes of
-- 
1.5.6.5


[-- Attachment #3: Type: text/plain, Size: 143 bytes --]

_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [sup-devel] [PATCH] Bugfix: Correctly split list of mail addresses
  2010-10-12 16:15 [sup-devel] [PATCH] Bugfix: Correctly split list of mail addresses Gregor Hoffleit
@ 2010-10-14  1:10 ` Rich Lane
  0 siblings, 0 replies; 2+ messages in thread
From: Rich Lane @ 2010-10-14  1:10 UTC (permalink / raw)
  To: Gregor Hoffleit; +Cc: sup-devel

Applied to master.
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-10-14  1:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-12 16:15 [sup-devel] [PATCH] Bugfix: Correctly split list of mail addresses Gregor Hoffleit
2010-10-14  1:10 ` Rich Lane

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox