Skip to content

Do not generate link previews from URLs in code/pre tags #16949

@MichaIng

Description

@MichaIng

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

  1. Post a link within code fences
    ```
    line of log with some https://example.org/to/some/api/or/so
    ```
    
  2. 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

Details ``` Insert your browser log here, this could for example include: a) The javascript console log b) The network log c) ... ```

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:

Details
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:

Details
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)

Details
Insert your server log here

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions