Drupal.urlIsLocal returns incorrect result if site URL contains authentication part

Created on 11 April 2017, about 8 years ago
Updated 7 April 2023, about 2 years ago

Open https://www.drupal.org/ β†’ in browser.
In the browser console, see the result of Drupal.urlIsLocal('/views/ajax');

Open https://1:1@www.drupal.org/ in browser.
In the browser console, see the result of Drupal.urlIsLocal('/views/ajax');

The first result is true.
The second result is false.

So such URLs are rejected by AJAX system, and the error is shown:
The callback URL is not local and not trusted: /views/ajax

Drupal.urlIsLocal() must support the case when Drupal.absoluteUrl() returns URLs with authentication parts (user:password@).

πŸ› Bug report
Status

Needs work

Version

10.1 ✨

Component
AjaxΒ  β†’

Last updated about 1 hour ago

Created by

πŸ‡·πŸ‡ΊRussia maximpodorov

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

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