Mercurial > hg > soundsoftware-site
changeset 1552:3a2254124fa8 feature_1136
Discard certain malformed email addresses
author | Chris Cannam |
---|---|
date | Wed, 13 Jan 2016 11:14:28 +0000 |
parents | 36dddb6755f6 |
children | baac54711ee9 |
files | extra/soundsoftware/create-repo-authormaps.rb |
diffstat | 1 files changed, 13 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/extra/soundsoftware/create-repo-authormaps.rb Tue Jan 12 17:55:48 2016 +0000 +++ b/extra/soundsoftware/create-repo-authormaps.rb Wed Jan 13 11:14:28 2016 +0000 @@ -93,6 +93,19 @@ authormap = "" committers.each do |c, uid| + + # Some of our repos have broken email addresses in them: e.g. one + # changeset has a committer name of the form + # + # NAME <name <NAME <name@example.com"> + # + # I don't know how it got like that... If the committer has more + # than one '<' in it, truncate it just before the first one, and + # then we look up the author name again. + if c =~ /<.*</ then + c = c.sub(/\s*<.*$/, "") + end + if not c =~ /[^<]+<.*@.*>/ then user = User.find_by_id uid authormap << "#{c}=#{user.name} <#{user.mail}>\n" unless user.nil?