Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Envelope parsing fails with empty headers #452

Closed
kazuoteramoto opened this Issue · 5 comments

2 participants

@kazuoteramoto

Hi!

Parsing mail text that contains empty headers fails after 1087549.

This happens because 'To: ' get stripped to 'To:' and spliting at ': ' only return one value.

The relevant part of the log:

DEBUG:envelope:GoT: """
To: 
From: Kazuo Teramoto <kaz.rag@gmail.com>
Subject: 


"""
DEBUG:ui:Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/alot/ui.py", line 479, in apply_command
    d = defer.maybeDeferred(cmd.apply, self)
  File "/usr/lib/python2.7/site-packages/twisted/internet/defer.py", line 134, in maybeDeferred
    result = f(*args, **kw)
  File "/usr/lib/python2.7/site-packages/alot/commands/envelope.py", line 282, in apply
    ui.apply_command(cmd)
  File "/usr/lib/python2.7/site-packages/alot/ui.py", line 479, in apply_command
    d = defer.maybeDeferred(cmd.apply, self)
--- <exception caught here> ---
  File "/usr/lib/python2.7/site-packages/twisted/internet/defer.py", line 134, in maybeDeferred
    result = f(*args, **kw)
  File "/usr/lib/python2.7/site-packages/alot/commands/globals.py", line 248, in apply
    return ExternalCommand.apply(self, ui)
  File "/usr/lib/python2.7/site-packages/alot/commands/globals.py", line 206, in apply
    afterwards(ret)
  File "/usr/lib/python2.7/site-packages/alot/commands/globals.py", line 172, in afterwards
    self.on_success()
  File "/usr/lib/python2.7/site-packages/alot/commands/envelope.py", line 236, in openEnvelopeFromTmpfile
    only_body=self.edit_only_body)
  File "/usr/lib/python2.7/site-packages/alot/db/envelope.py", line 261, in parse_template
    key, value = line.strip().split(': ', 1)  # parse new pair
exceptions.ValueError: need more than 1 value to unpack
@pazz
Owner

outch! i did not realize that (not using this feature myself).
maybe we should rather use 8a49f9c instead?

@kazuoteramoto

8a49f9c looks good to me, not only it solve the current problem but it make 'Subject: Hello' give the same value as 'Subject:    Hello', something that looks reasonable to me.

@pazz
Owner

aye! plz check out branch 0.3.1-fix-452

@kazuoteramoto

Works with empty headers, and values having multiples spaces. Looks OK for me.

@pazz
Owner

pushed, thx

@pazz pazz closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.