Sometimes we're want to not specify http:// or https:// scheme for URL and use wildcard - //.

For now this behavior is impossible due to parse_url() function, in this case, will not return an array with scheme key and we'll get an InvalidArgumentException.

Comments

BR0kEN created an issue. See original summary.

br0ken’s picture

Status: Active » Needs review
StatusFileSize
new1.51 KB

Status: Needs review » Needs work

The last submitted patch, 2: drupal-wildcard-url-scheme-2710785-2.patch, failed testing.

br0ken’s picture

StatusFileSize
new1.99 KB
new380 bytes
br0ken’s picture

Status: Needs work » Needs review
br0ken’s picture

And, by the way, this was already possible (before the patch) in libraries definition:

google-map:
  js:
    //maps.googleapis.com/maps/api/js?libraries=places: {}
unstatu’s picture

Issue tags: +DrupalCampES
StatusFileSize
new2.29 KB
new556 bytes

+1

I have added a URI with wildcard in UnroutedUrlTest::providerFromUri as well.

mac_weber’s picture

Status: Needs review » Closed (duplicate)

Thank you everybody who contributed to this issue. This is actually a duplicate of an older issue which I'd like to invite you to review and contribute: #2573635: Url::fromUri() should accept protocol-relative URLs

liquidcms’s picture

Not trying to be sarcastic, but why would anyone ever want to enter //example.com? Aren't these the only (or at least 99%) use cases?

- http://example.com
- https://example.com
- http://www.example.com
- example.com
- www.example.com

that's it.