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

UnicodeDecodeError traceback on URL preview #4585

Open
ptman opened this issue Feb 7, 2019 · 2 comments
Open

UnicodeDecodeError traceback on URL preview #4585

ptman opened this issue Feb 7, 2019 · 2 comments
Labels
A-URL-Preview Issues related to generating server-side previews of remote URLs O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. z-bug (Deprecated Label) Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution z-p2 (Deprecated Label)

Comments

@ptman
Copy link
Contributor

ptman commented Feb 7, 2019

Description

UnicodeDecodeError

Steps to reproduce

synapse.http.server - 112 - ERROR - GET-132- Failed handle request via <function PreviewUrlResource._async_render_GET at 0x7fd5271cd2f0>: <XForwardedForRequest at 0x7fd525a65da0 method='GET' uri='/_matrix/media/r0/preview_url?url=http%3A%2F%2Fwww.sirkusaikamoinen.com%2Ffutureperformances%2Fnomad-i-mariagrdens-kyrkosal-i-borg%E2%80%8B&ts=1539766933898' clientproto='HTTP/1.1' site=8008>: Traceback (most recent call last):
  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 110, in _async_render_GET
    url = parse_string(request, "url")
  File "/usr/local/lib/python3.6/site-packages/synapse/http/servlet.py", line 144, in parse_string
    request.args, name, default, required, allowed_values, param_type, encoding
  File "/usr/local/lib/python3.6/site-packages/synapse/http/servlet.py", line 158, in parse_string_from_args
    value = value.decode(encoding)
builtins.UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 86: ordinal not in range(128)
synapse.http.server - 112 - ERROR - GET-134- Failed handle request via <function PreviewUrlResource._async_render_GET at 0x7fd5271cd2f0>: <XForwardedForRequest at 0x7fd525e9a748 method='GET' uri='/_matrix/media/r0/preview_url?url=http%3A%2F%2Fwww.haaganpuro.fi%2Fajankohtaista%2Fr-i-p-pirkko%2F%E2%80%8B&ts=1539852446322' clientproto='HTTP/1.1' site=8008>: Traceback (most recent call last):
  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 110, in _async_render_GET
    url = parse_string(request, "url")
  File "/usr/local/lib/python3.6/site-packages/synapse/http/servlet.py", line 144, in parse_string
    request.args, name, default, required, allowed_values, param_type, encoding
  File "/usr/local/lib/python3.6/site-packages/synapse/http/servlet.py", line 158, in parse_string_from_args
    value = value.decode(encoding)
builtins.UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 52: ordinal not in range(128)

Version information

  • Version: 0.99.0
  • Install method: docker
  • Platform: Linux
@erikjohnston
Copy link
Member

Internal matrix.org Sentry issue: SYNAPSE-MATRIXORG-G

@erikjohnston erikjohnston added the Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution label Mar 6, 2019
@clokep
Copy link
Member

clokep commented Mar 17, 2023

This now seems to give:

{"errcode":"M_UNKNOWN","error":"Query parameter 'url' must be ascii"}

@squahtx squahtx added T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. A-URL-Preview Issues related to generating server-side previews of remote URLs S-Minor Blocks non-critical functionality, workarounds exist. O-Uncommon Most users are unlikely to come across this or unexpected workflow labels Mar 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-URL-Preview Issues related to generating server-side previews of remote URLs O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. z-bug (Deprecated Label) Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution z-p2 (Deprecated Label)
Projects
None yet
Development

No branches or pull requests

5 participants