rickypc / robotframework-imaplibrary

IMAP email testing library for Robot Framework
https://pypi.python.org/pypi/robotframework-imaplibrary
Apache License 2.0
21 stars 35 forks source link

Get Email Body decodes URLs with issues #24

Closed bobmeliev closed 4 years ago

bobmeliev commented 4 years ago

URLs are decoded with issues, for instance URL

<a href="https://example.com/verify-account?uid=5dd50bc5d3b1f228474551d7&t=98e1ee0c-a159-475e-a0e3-f74a533d48c8">

is decoded as

<a href="https://example.com/verify-account?uid]d50bc5d3b1f228474551d7&t˜e1ee0c-a159-475e-a0e3-f74a533d48c8">

Here is Python code of function get_email_body():

        if self._is_walking_multipart(email_index):
            body = self.get_multipart_payload(decode=True)
        else:
            encoded_body = self._imap.uid('fetch', email_index, '(BODY[TEXT])')[1][0][1]
            try:
                body = decode(encoded_body, 'quopri_codec').decode('UTF-8')
            except:
                body = decode(encoded_body, 'quopri_codec').decode('ISO-8859-1')
        return body
bobmeliev commented 4 years ago

Issue is moved to https://github.com/lasselindqvist/robotframework-imaplibrary2/issues/3