Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] parse_attachment > cannot parse name #228

Merged
merged 1 commit into from
Sep 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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