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

Issue with duplicate attachments #214

Closed
jimmi2051 opened this issue Dec 24, 2021 · 4 comments
Closed

Issue with duplicate attachments #214

jimmi2051 opened this issue Dec 24, 2021 · 4 comments

Comments

@jimmi2051
Copy link

Hi, I'm Thanh. I have an issue with duplicate attachments.
I have received an email with 5 attachments but it is the same file. And in Gmail show only 1 file. But in code, we read it is 5 attachments .
So it is broken.

image

image

@sebix
Copy link

sebix commented Dec 26, 2021

What does the emails source code reveal?

@jimmi2051
Copy link
Author

yep, here is my issue >

  File "/usr/src/app/sap/model_helpers/email_attachment_mixin.py", line 57, in pull_attachments_from_email
    for (uid, message) in unread_inbox_messages:
  File "/root/.local/share/virtualenvs/app-lp47FrbD/lib/python3.8/site-packages/imbox/messages.py", line 55, in _fetch_email_list
    yield uid, self._fetch_email(uid)
  File "/root/.local/share/virtualenvs/app-lp47FrbD/lib/python3.8/site-packages/imbox/messages.py", line 42, in _fetch_email
    return fetch_email_by_uid(uid=uid,
  File "/root/.local/share/virtualenvs/app-lp47FrbD/lib/python3.8/site-packages/imbox/parser.py", line 155, in fetch_email_by_uid
    email_object = parse_email(raw_email, policy=parser_policy)
  File "/root/.local/share/virtualenvs/app-lp47FrbD/lib/python3.8/site-packages/imbox/parser.py", line 212, in parse_email
    attachment = parse_attachment(part)
  File "/root/.local/share/virtualenvs/app-lp47FrbD/lib/python3.8/site-packages/imbox/parser.py", line 122, in parse_attachment
    filename_parts.insert(int(s_name[1]),value[1:-1] if value.startswith('"') else value)
ValueError: invalid literal for int() with base 10: ''

@sebix
Copy link

sebix commented Dec 27, 2021

Duplicate of #198

@jimmi2051
Copy link
Author

Thanks @sebix .
I have tried to bypass function parse and I got names of some files are utf-8-'***'
Example:

[ '02 Vu Thi My Hao.docx', 
'CV Hoang Minh Tu.docx', 
"utf-8''L%C3%AA%20H%E1%BB%AFu%20Vi%E1%BB%87t%20%2D%20QA%20%2D%20H%C3%A0%20N%E1%BB%99i.docx", 
'04 Pham Nguyen Huyen Thanh.doc', 
"utf-8''HO%5FSO%5FTh%C3%B4ng%20tin%20c%C3%A1%20nh%C3%A2n%2Dmss%20h%C3%A0.doc", 'VoThiThuyTien.pdf', 
'NguyenThanhHauResume.pdf', 
'NGUYEN-CONG-MINH-TopCV.vn-080720.03323.pdf']

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

2 participants