Skip to content

Commit

Permalink
Merge pull request #228 from jimmi2051/master
Browse files Browse the repository at this point in the history
[Fix] parse_attachment > cannot parse name
  • Loading branch information
martinrusev authored Sep 24, 2022
2 parents 43e9b5b + cc1cf2d commit faf5502
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions imbox/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,15 @@ def parse_attachment(message_part):
# Check for split filename
s_name = name.rstrip('*').split("*")
if s_name[0] == 'filename':
# If this is a split file name - use the number after the * as an index to insert this part
if len(s_name) > 1 and s_name[1] != '':
filename_parts.insert(int(s_name[1]),value[1:-1] if value.startswith('"') else value)
else:
filename_parts.insert(0,value[1:-1] if value.startswith('"') else value)
try:
# If this is a split file name - use the number after the * as an index to insert this part
if len(s_name) > 1 and s_name[1] != '':
filename_parts.insert(int(s_name[1]),value[1:-1] if value.startswith('"') else value)
else:
filename_parts.insert(0,value[1:-1] if value.startswith('"') else value)
except Exception as err:
logger.debug('Parse attachment name error: %s', err)
filename_parts.insert(0, value)

if 'create-date' in name:
attachment['create-date'] = value
Expand Down

0 comments on commit faf5502

Please sign in to comment.