Link field should accept protocol-relative URLs

Created on 8 June 2016, about 8 years ago
Updated 13 March 2023, over 1 year ago

Problem/Motivation

This was forked from #2573635: Url::fromUri() should accept protocol-relative URLs , which is where this very same thing was originally being solved. It was descoped to only add API support.

Link field only accepts external URLs with "http://" or "https://". It should also support protocol-relative URLs e.g "//example.com". Otherwise we're limiting URLs for no good reason, which is simply a Drupalism. See #2573635-44: Url::fromUri() should accept protocol-relative URLs for a longer rationale.

Proposed resolution

Allow any valid URL to be linked.

Remaining tasks

  • Discuss how to handle the HTML5 validation, which by default does not accept URLs without a protocol.
  • Discuss the need of the double slash at the beginning of protocol relative URLs, accepting "example.com" as a valid external URL.

User interface changes

None.

API changes

None.

Data model changes

None.

Feature request
Status

Needs review

Version

10.1

Component
Link 

Last updated 3 days ago

Created by

🇧🇪Belgium Wim Leers Ghent 🇧🇪🇪🇺

Live updates comments and jobs are added and updated live.
  • 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.

Production build 0.71.5 2024