wmorgan / heliotrope

A personal, threaded, search-centric email server.
124 stars 17 forks source link

heliotrope-add -m mbox crashes in transcode #23

Closed a1exsh closed 12 years ago

a1exsh commented 13 years ago

Just tried importing my old mbox with this command:

ruby -Ilib bin/heliotrope-add -m ~/tmp/mailbox -d data

and got this crash at some point:

* wrote broken message to bad-message.txt
end offset is 29492938
/home/ash/src/heliotrope/lib/heliotrope/decoder.rb:50:in `force_encoding': can't convert nil into String (TypeError)
from /home/ash/src/heliotrope/lib/heliotrope/decoder.rb:50:in `transcode'
from /home/ash/src/heliotrope/lib/heliotrope/message.rb:265:in `mime_content_for'
from /home/ash/src/heliotrope/lib/heliotrope/message.rb:187:in `decode_mime_parts'
from /home/ash/src/heliotrope/lib/heliotrope/message.rb:181:in `block in decode_mime_parts'
from /home/ash/src/heliotrope/lib/heliotrope/message.rb:181:in `map'
from /home/ash/src/heliotrope/lib/heliotrope/message.rb:181:in `decode_mime_parts'
from /home/ash/src/heliotrope/lib/heliotrope/message.rb:147:in `mime_parts'
from /home/ash/src/heliotrope/lib/heliotrope/message.rb:133:in `has_attachment?'
from /home/ash/src/heliotrope/lib/heliotrope/meta-index.rb:72:in `add_message'
from bin/heliotrope-add:149:in `<main>'

Ruby version:

$ type ruby
ruby is hashed (/home/ash/.rvm/rubies/ruby-1.9.2-p290/bin/ruby)
$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
a1exsh commented 13 years ago

The problem appears to be with the html_to_text converter and Locale.current.charset. The latter gives nil on my system, which gets passed to transcode and fails as described above.

a1exsh commented 13 years ago

Filed an issue with locale gem: https://github.com/mutoh/locale/issues/4

wmorgan commented 12 years ago

Good debugging. I have a fix for this which I will push shortly. Thanks!

wmorgan commented 12 years ago

This has been pushed. Please reopen if it still occurs.