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

parse_attachment function line 129 indented less? #188

Closed
walirt opened this issue Jun 4, 2020 · 5 comments
Closed

parse_attachment function line 129 indented less? #188

walirt opened this issue Jun 4, 2020 · 5 comments

Comments

@walirt
Copy link

walirt commented Jun 4, 2020

imbox/imbox/parser.py

Lines 108 to 130 in 085da07

filename = message_part.get_param('name')
if filename:
attachment['filename'] = filename
filename_parts = []
for param in dispositions[1:]:
if param:
name, value = decode_param(param)
# Check for split filename
s_name = name.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:
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)
if 'create-date' in name:
attachment['create-date'] = value
attachment['filename'] = "".join(filename_parts)
return attachment

attachment ['filename '] is assigned on lines 110 and 129, but line 129 will override the previous value anyway, Is this a bug?

@ghost
Copy link

ghost commented Jun 5, 2020

That was introduced in #186 which fixed the filename parsing - that's where the overwriting code comes from. I agree that the first statement can be removed.

@pka69
Copy link

pka69 commented Jun 8, 2020

I have this problem. Attachment content-type is excel file, but filename=''.

@martinrusev
Copy link
Owner

@Ri773r Fixed in 5aabe0d

@ghost
Copy link

ghost commented Jun 9, 2020

I have this problem. Attachment content-type is excel file, but filename=''.

Are you sure that this is related?

@pka69
Copy link

pka69 commented Jun 9, 2020

I thought so.
But now I see it can be something different.

@walirt walirt closed this as completed Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants