Link field doesn't sufficiently validate input

Created on 9 January 2018, over 7 years ago
Updated 14 August 2025, about 24 hours ago

Problem/Motivation

Currently, In default link field we have URL and Link text.
URL field accepts multiple URLs, which leads to creating broken URL in the node view page.

e.g. I can add 2 urls same time https://www.google.com, https://www.google.in
and in node view, it comes as https://www.google.com%2C%20https//www.google.in

See attached images:

Steps to reproduce

  1. Add a Link Field to a content type allow one value
  2. Add a node of that content type and in the Link field add two Urls separated by a comma, for example, https://www.google.com, https://www.google.in.
  3. Save - notice no errors

Proposed resolution

Validate the field using UrlElement::validateUrl()

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component

link.module

Created by

🇮🇳India chintan4u Pune

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
Production build 0.71.5 2024