Source: gnome-gmail
Version: 2.7-2
Severity: important

Dear Maintainer,

When running gnome-gmail autopkgtest with Python ≥ 3.9.5, test_body2html
fails. That version is currently available in Debian experimental. The failing
configurations are:

- test_body2html[False-a\tb-a b]
- test_body2html[False-a\nb-a<br>\nb]
- test_body2html[False-a\nb\nc-a<br>\nb<br>\nc]

For example, the first configuration fails with this error:

  _____________________ test_body2html[False-a\tb-a&emsp;b] 
______________________

  encbody = False, body = 'a\tb', result = 'a&emsp;b'

      @pytest.mark.parametrize("body, result", testCaseStrings)
      @pytest.mark.parametrize("encbody", (False, True))
      def test_body2html(encbody, body, result):

          if encbody:
              body = urllib.parse.quote(body)
          elif '&' in body or '#' in body:
              pytest.skip("Don't test unencoded bodies with URL special chars")

          gmapi = get_gmapi(baseMailtoURL + body)

          html_body = gmapi.body2html()

  >       assert result in html_body
  E       AssertionError: assert 'a&emsp;b' in 
'<html>\n<head>\n</head>\n<body>\nab\n</body>\n</html>'

  test/test_body.py:106: AssertionError

It happens because starting with Python 3.9.5, urllib.parse.urlsplit() removes
newline and tabs:

https://github.com/python/cpython/commit/491fde0161d5e527

And that function is called by gnome-gmail's mailto2dict() function.

Compare:

  Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
  [GCC 10.2.1 20210110] on linux
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import urllib.parse
  >>> urllib.parse.urlsplit("mailto:joe?body=a\tb";, "mailto")
  SplitResult(scheme='mailto', netloc='', path='joe', query='body=a\tb', 
fragment='')

and:

  Python 3.9.5 (default, May  6 2021, 09:11:34) 
  [GCC 10.2.1 20210110] on linux
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import urllib.parse
  >>> urllib.parse.urlsplit("mailto:joe?body=a\tb";, "mailto")
  SplitResult(scheme='mailto', netloc='', path='joe', query='body=ab', 
fragment='')

--
Dmitry Shachnev

Attachment: signature.asc
Description: PGP signature

Reply via email to