element-hq / element-hq/synapse
Preview of a link is showing "Internet Explorer is not supported"
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
This issue has been migrated from [#15598](https://github.com/matrix-org/synapse/issues/15598).
---
### Description
URL previews seem to fetched with an outdated useragent string claiming IE. This can trigger warnings to update the browser in the URL preview instead of a helpful preview
### Steps to reproduce
Send a message with a link. (example https://delft.notubiz.nl/)
Matrix server will fetch a preview.
If this is a link to a website hat warns about outdated browsers, the preview shows the warning about outdated browser:
"Gemeente Delft Ga direct naar: Navigatie Let op: U gebruikt Internet Explorer. Vanaf 31 maart 2021 wordt Internet Explorer 11 niet meer ondersteund als browser door dit portaal. Wij adviseren u om gebruik te maken van Microsoft Edge, Google Chrome of Mozilla FireFox."
translation: "Municipality of Delft Go directly to: Navigation Please note: You are using Internet Explorer. From 31 March 2021, Internet Explorer 11 will no longer be supported as a browser by this portal. We advise you to use Microsoft Edge, Google Chrome or Mozilla FireFox."
What did you expect?
A preview of the site that the link points to
What happened instead?
The preview fetching passes a warning from the website about outdated browser, which is false.
Probable cause
I suspect that the useragent string used to fetch the preview is incorrect and outdated. It would be better if Element uses a useragent string that is modern and aligns with the OS on which it is running. (Element on Linux, not IE on Windows)
When testing with a useragent switcher tool (https://add0n.com/useragent-switcher.html) the website https://delft.notubiz.nl/ gives this warning when sending an IE useragent string, so the warning is useragent string dependent.
### Homeserver
matrix.org
### Synapse Version
"server_version":"1.83.0 (b=matrix-org-hotfixes,106fb7005d)","python_version":"3.8.12"
### Installation Method
I don't know
### Database
unknown
### Workers
I don't know
### Platform
unknown.
### Configuration
_No response_
### Relevant log output
```shell
Preview of https://delft.notubiz.nl/
"Gemeente Delft Ga direct naar: Navigatie Let op: U gebruikt Internet Explorer. Vanaf 31 maart 2021 wordt Internet Explorer 11 niet meer ondersteund als browser door dit portaal. Wij adviseren u om gebruik te maken van Microsoft"
```
### Anything else that would be useful to know?
Not my server.
Bug first reported in Element desktop: #961
Contributor guide
Research direction
Start by tracing Synapse's URL-preview fetching path and reproduce the issue with https://delft.notubiz.nl/. Inspect the user-agent used for the fetch and compare the resulting preview with a modern browser request. Done means the preview shows the site's content rather than an Internet Explorer warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100