Handle protocol-relative URLs in LinkWidget

Created on 26 June 2017, over 8 years ago
Updated 11 August 2025, about 2 months ago

Problem/Motivation

Protocol-relative URLs are saved by LinkWidget as internal:. LinkWidget::getUserEnteredStringAsUri() checks for URL strings that have no scheme, which is true for protocol-relative URLs, and assumes they are internal.

Steps to reproduce:

  1. Add a Link field to any content type.
  2. Create a new instance of that content type. In the link field, add a protocol-relative URL like: '//www.google.com'.
  3. Check the database table for the Link field that you created. See that the value in the uri column is internal://www.google.com.

Initially this report stated that when viewing the node the link was formatted as being an internal relative link. But now in D11 the link isn't rendered at all.

Proposed resolution

Make LinkWidget detect and handle protocol-relative URLs.

Remaining tasks

  1. Write an MR.
  2. Review.
  3. Commit.

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component

link.module

Created by

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