Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the SVN-Notify CPAN distribution.

Report information
The Basics
Id: 61855
Status: rejected
Priority: 0/
Queue: SVN-Notify

People
Owner: Nobody in particular
Requestors: iusty [...] k1024.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Enhance regexp-map/email-map do use groups from the matched regexp
Hi, Currently, the email target for a matching regex (-x) is static. For more flexibility, it should be possible to specify groups from the matched regexp as components of the email address. Attached is a diff that implements this in a hackish way (sorry, my Perl foo is not good). It might be possible to do this in a better way (e.g. without re-doing the pattern match, or without $&), but I hope my patch explains the desired behaviour. regards, iustin
Subject: svnnotify-regex-groups2.patch
Index: lib/SVN/Notify.pm =================================================================== --- lib/SVN/Notify.pm (revision 4848) +++ lib/SVN/Notify.pm (working copy) @@ -1138,7 +1138,11 @@ # If the directory matches the regex, save the email. if (/$rx/) { $self->_dbpnt( qq{"$_" matched $rx}) if $self->{verbose} > 2; - push @$tos, $email unless $seen{$email}++; + # replace $1, $2, ... in the email with any matched groups + my @repl = /$rx/; + my $fix_email = $email; + $fix_email =~ s/\$(\d+)/$repl[$1-1] || $&/eg; + push @$tos, $fix_email unless $seen{$fix_email}++; } } # Grab the context if it's needed for the subject.
Thanks, but I think it is dangerous, security-wise, to extract email addresses from matched text. Too easy to exploit and inject stuff.