Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
From: Gregor Hoffleit <gregor@hoffleit.de>
To: sup-devel <sup-devel@rubyforge.org>
Subject: [sup-devel] [PATCH] Bugfix: Correctly split list of mail addresses
Date: Tue, 12 Oct 2010 18:15:59 +0200	[thread overview]
Message-ID: <1286900062-sup-8729@sam.mediasupervision.de> (raw)

[-- 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

             reply	other threads:[~2010-10-12 16:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-12 16:15 Gregor Hoffleit [this message]
2010-10-14  1:10 ` Rich Lane

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1286900062-sup-8729@sam.mediasupervision.de \
    --to=gregor@hoffleit.de \
    --cc=sup-devel@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox