Subject: [sup-devel] heliotrope: Crash with empty message.recipients

From: Gregor Hoffleit <[email-masked]>
Date: Thu, 21 Apr 2011 12:18:52 +0200

I noticed that heliotrope-add bangs out on message
<[email-masked]> from the debian-vote list:
http://lists.debian.org/debian-vote/2008/03/msg00130.html

# ruby1.9.1 -Ilib ./bin/heliotrope-add -m debian-vote-2008 -d test
/home/test/GIT/heliotrope/lib/heliotrope/index.rb:482:in `block in index!': undefined method `indexable_text' for nil:NilClass (NoMethodError)
    from /home/test/GIT/heliotrope/lib/heliotrope/index.rb:482:in `map'
    from /home/test/GIT/heliotrope/lib/heliotrope/index.rb:482:in `index!'
    from /home/test/GIT/heliotrope/lib/heliotrope/index.rb:80:in `add_message'
    from ./bin/heliotrope-add:113:in `<main>'

As you can see even in the HTML representation of the message linked
above:

    To: , [email-masked]

This code in line 482 of lib/heliotrope/index.rb will fail work if any
recipient is empty:

    message.recipients.map { |x| x.indexable_text }.join(" ").downcase

Sadly, I'm lacking the Ruby skills to make heliotrope cope with such
pathological messages. In Python, I would fix it like this:

    [x.indexable_text for x in message.recipients if x]

Regards,
    Gregor
_______________________________________________
Sup-devel mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-devel