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

URL preview should use Accept-Language: en-US, en by default #11604

Open
spantaleev opened this issue Dec 18, 2021 · 1 comment
Open

URL preview should use Accept-Language: en-US, en by default #11604

spantaleev opened this issue Dec 18, 2021 · 1 comment
Labels
P3 (OBSOLETE: use S- labels.) Approved backlog: not yet scheduled, will accept patches T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.

Comments

@spantaleev
Copy link
Contributor

Description

This is about the url_preview_accept_language setting, which seems to have a default value of ['en'].

This may be site-specific, but.. as an example, I find that doing curl -H 'Accept-Language: en' 'https://www.imdb.com/title/tt13207508/' | grep Schwanengesang yields a result for me ("Schwanengesang" being the German title of the "Swan Song" movie) when done from a German IP address.

A way to get it to stop IMDB from feeding me German content (when accessing it from a German IP address) is to use a different Accept-Language value. Both en-US and en-US, en seem to work well.

Given that browsers (Firefox, Chromium) seem to pass both {languageCode}-{countryCode} and {languageCode} at the same time, it's probably more reliable if Synapse does the same (sending Accept-Language: en-US, en).

Version information

  • Version: v1.49.0 seems affected by default
spantaleev added a commit to spantaleev/matrix-docker-ansible-deploy that referenced this issue Dec 18, 2021
Related to matrix-org/synapse#11604

Getting an upstream fix is preferable. In any case, it's probably nice
to have this defined explicitly in our configuration. This way, people
can more easily discover that they can override the URL preview
language.
@clokep
Copy link
Contributor

clokep commented Dec 20, 2021

Seems like it would be a reasonable change to make. Would you mind making a pull request to update the default/sample configuration(s)?

@richvdh richvdh changed the title 'Accept-Language: en' is less reliable than 'en-US, en' URL preview should use Accept-Language: en-US, en by default Dec 23, 2021
@richvdh richvdh added P3 (OBSOLETE: use S- labels.) Approved backlog: not yet scheduled, will accept patches T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. labels Dec 23, 2021
HarHarLinks pushed a commit to HarHarLinks/matrix-docker-ansible-deploy that referenced this issue Feb 16, 2022
Related to matrix-org/synapse#11604

Getting an upstream fix is preferable. In any case, it's probably nice
to have this defined explicitly in our configuration. This way, people
can more easily discover that they can override the URL preview
language.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 (OBSOLETE: use S- labels.) Approved backlog: not yet scheduled, will accept patches T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.
Projects
None yet
Development

No branches or pull requests

3 participants