Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

The link preview API is broken on Python 3 #4150

Closed
hawkowl opened this issue Nov 5, 2018 · 5 comments
Closed

The link preview API is broken on Python 3 #4150

hawkowl opened this issue Nov 5, 2018 · 5 comments
Assignees
Labels
z-bug (Deprecated Label) z-major (Deprecated Label)

Comments

@hawkowl
Copy link
Contributor

hawkowl commented Nov 5, 2018

Reports from users in matrix HQ that it's stopped working since the upgrade.

@hawkowl hawkowl added z-bug (Deprecated Label) z-major (Deprecated Label) release blocker labels Nov 5, 2018
@hawkowl hawkowl self-assigned this Nov 5, 2018
@hawkowl hawkowl changed the title The link preview API is broken in 0.33.8 The link preview API is broken on Python 3 Nov 5, 2018
@hawkowl
Copy link
Contributor Author

hawkowl commented Nov 5, 2018

Traceback courtesy of Tulir:

  File "/usr/local/lib/python3.6/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
    result = g.send(result)
  File "/usr/local/lib/python3.6/site-packages/synapse/http/server.py", line 81, in wrapped_request_handler
    yield h(self, request)
  File "/usr/local/lib/python3.6/site-packages/twisted/internet/defer.py", line 1613, in unwindGenerator
    return _cancellableInlineCallbacks(gen)
  File "/usr/local/lib/python3.6/site-packages/twisted/internet/defer.py", line 1529, in _cancellableInlineCallbacks
    _inlineCallbacks(None, g, status)
--- <exception caught here> ---
  File "/usr/local/lib/python3.6/site-packages/synapse/http/server.py", line 81, in wrapped_request_handler
    yield h(self, request)
  File "/usr/local/lib/python3.6/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
    result = g.send(result)
  File "/usr/local/lib/python3.6/site-packages/synapse/rest/media/v1/preview_url_resource.py", line 161, in _async_render_GET
    respond_with_json_bytes(request, 200, og, send_cors=True)
  File "/usr/local/lib/python3.6/site-packages/synapse/http/server.py", line 457, in respond_with_json_bytes
    bytes_io = BytesIO(json_bytes)
builtins.TypeError: a bytes-like object is required, not 'str'

@hawkowl
Copy link
Contributor Author

hawkowl commented Nov 5, 2018

Likely same symptoms: #2915

@hawkowl
Copy link
Contributor Author

hawkowl commented Nov 5, 2018

Also likely similar: #2681

@richvdh richvdh added the py3 label Nov 6, 2018
@hawkowl
Copy link
Contributor Author

hawkowl commented Nov 6, 2018

  File "/home/matrix/synapse-venv/lib/python3.6/site-packages/synapse/rest/media/v1/media_repository.py", line 332, in _get_remote_media_impl
    server_name, media_id, file_id
  File "/home/matrix/synapse-venv/lib/python3.6/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
    result = g.send(result)
  File "/home/matrix/synapse-venv/lib/python3.6/site-packages/synapse/rest/media/v1/media_repository.py", line 405, in _download_remote_file
    _, params = cgi.parse_header(content_disposition[0].decode('ascii'),)
builtins.UnicodeDecodeError: 'ascii' codec can't decode byte 0xce in position 18: ordinal not in range(128)

similar problem...

@hawkowl
Copy link
Contributor Author

hawkowl commented Nov 7, 2018

Fixed by #4157

@hawkowl hawkowl closed this as completed Nov 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
z-bug (Deprecated Label) z-major (Deprecated Label)
Projects
None yet
Development

No branches or pull requests

2 participants