Do not generate link previews from URLs in code/pre tags
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2.2k
- Forks
- 586
- Avg merge
- 18h 27m
- Merged PRs (30d)
- 333
Description
How to use GitHub
- Please use the 👍 reaction to show that you are affected by the same issue.
- Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
- Subscribe to receive notifications on status change and new comments.
Steps to reproduce
- Post a link within code fences
``` line of log with some https://example.org/to/some/api/or/so ``` - Watch link preview getting generated
Expected behaviour
Code fences are usually used to post either code or lines of logs to be verbatim and/or easy to copy. Especially links in logs are really not meant to be visited in the browser.
I would skip it similarly for inline code blocks like
Text with `inline code where I would not want any https://example.link` to be previewed.
In fact elsewhere, like here on GitHub I use code blocks and fences for links explicitly to avoid them being clickable, reduce the chance that bots and crawlers (try to) follow it etc.
Actual behaviour
It does generate a preview. E.g. I posted a webserver log line about a failing API call to the Collabora Online CODE server, and the requests for the preview generation produced more errors, spamming the logs 😄.
If some library is used for Markdown code block/fence interpretation, I hope there is a way to hook inside and flag those tags from being parsed by the URL preview generator. Or maybe the latter can jump over <code> and <pre> tags afterwards, if it parses the resulting HTML.
Talk app
Talk app version: 22.0.8
Custom Signaling server configured: no
Custom TURN server configured: yes (Coturn)
Custom STUN server configured: yes (Coturn)
Browser
Microphone available: yes/no
Camera available: yes/no
Operating system: Windows/Ubuntu/Mac/...
Browser name: Firefox/Chrome/Safari/...
Browser version: 124/125/...
Browser log
Server configuration
Operating system: Debian Trixie
Web server: Apache/Nginx
Database: MariaDB
PHP version: 8.4
Nextcloud Version: 32.0.5
List of activated apps:
If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your server installation folder
Nextcloud configuration:
If you have access to your command line run e.g.:
sudo -u www-data php occ config:list system
from within your Nextcloud installation folder
Server log (data/nextcloud.log)
Insert your server log here
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the URL preview generator and the Markdown handling for code fences and inline code, then reproduce the issue with a URL inside each form of code block. Done means URLs in code and pre tags no longer generate previews while ordinary URLs still do; the payload names no specific files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100