element-hq / element-hq/synapse

URL previews includes unicode punycode which causes issues URLs in the text body

Open
#14,068 0 comments 0 reactions 0 assignees View on GitHub
A-URL-Preview O-Uncommon S-Tolerable T-Defect
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

This issue has been migrated from [#14068](https://github.com/matrix-org/synapse/issues/14068).

---

### Description

https://github.com/vector-im/element-web/issues/23432

Synapse injects `“` (`5o0a`) punycode into og:description of twitter URLs, leading to broken links.

### Steps to reproduce

Forwarded Element issue:

### Steps to reproduce

1. Post a twitter URL into a room, URL previews enabled
2. Twitter post content is put into double quotes `""`
3. in case of media-only posts, the t.co media URL is in quotes
4. element includes the ending quote in the URL, resulting in a broken link

### Outcome

#### What did you expect?
links work
#### What happened instead?
![image](https://user-images.githubusercontent.com/2803622/194140184-3e32b90b-c99c-40ed-9ca4-94b8d67949fb.png)

Demo URLs for reference:
https://twitter.com/FXNetworks/status/1577704289476128771
https://twitter.com/mischiefanimals/status/1576904037449969664

### Operating system

arch

### Application version

Element Nightly version: 2022100501 Olm version: 3.2.12

### How did you install the app?

aur

### Homeserver

private

### Synapse Version

1.68.0

### Installation Method

Docker (matrixdotorg/synapse)

### Platform

debian, matrix-docker-ansible-deploy

### Relevant log output

```shell
n/a
```

### Anything else that would be useful to know?

```
curl "https://publish.twitter.com/oembed?url=https://twitter.com/mischiefanimals/status/1576904037449969664" | jq .
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 853 100 853 0 0 3946 0 --:--:-- --:--:-- --:--:-- 4140
{
"url": "https://twitter.com/mischiefanimals/status/1576904037449969664",
"author_name": "animals going goblin mode",
"author_url": "https://twitter.com/mischiefanimals",
"html": "

pic.twitter.com/fVP8YWHS2j

— animals going goblin mode (@mischiefanimals) October 3, 2022
\n\n",
"width": 550,
"height": null,
"type": "rich",
"cache_age": "3153600000",
"provider_name": "Twitter",
"provider_url": "https://twitter.com",
"version": "1.0"
}
```
https://user-images.githubusercontent.com/2403652/194146661-044758f9-fefd-4744-9ef2-bd3aec094d40.png

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.