Improve external URL validation in many ways

Created on 20 March 2016, almost 9 years ago
Updated 24 April 2024, 8 months ago

Problem/Motivation

While working in some issues I realized the need to improve UrlHelper::isValid()( in the file ./core/lib/Drupal/Component/Utility/UrlHelper.php

The issues I've found:

  • Punycode (International Domain Names) URLs cannot be validated
  • It does not accept protocol-relative URLs
  • It does not take in account the allowed protocols because it does not use UrlHelper::getAllowedProtocols()
  • It uses custom regex, while we could use Symfony UrlValidator which has a similar regex

Currently the Symfony UrlValidator also has some issues:

  • It depends of context, which is not available at UrlHelper::isValid()
  • Its code has some bugs displaying the exception's messages

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
RoutingΒ  β†’

Last updated 3 days ago

Created by

πŸ‡§πŸ‡·Brazil Mac_Weber

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