mirror of
https://github.com/getgrav/grav.git
synced 2026-01-31 20:00:21 +01:00
better support for external urls in Utils::url()
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
# v1.7.46
|
||||
## mm/dd/2024
|
||||
|
||||
1. [](#improved)
|
||||
* Better handling of external protocols in `Utils::url()` such as `mailto:`, `tel:`, etc.
|
||||
1. [](#bugfix)
|
||||
* Fixes for multi-lang taxonomy when reinitializing the languages (e.g. LangSwitcher plugin)
|
||||
|
||||
|
||||
@@ -742,7 +742,7 @@ class Uri
|
||||
*/
|
||||
public static function isExternal($url)
|
||||
{
|
||||
return (0 === strpos($url, 'http://') || 0 === strpos($url, 'https://') || 0 === strpos($url, '//'));
|
||||
return (0 === strpos($url, 'http://') || 0 === strpos($url, 'https://') || 0 === strpos($url, '//') || 0 === strpos($url, 'mailto:') || 0 === strpos($url, 'tel:') || 0 === strpos($url, 'ftp://') || 0 === strpos($url, 'ftps://') || 0 === strpos($url, 'news:') || 0 === strpos($url, 'irc:') || 0 === strpos($url, 'gopher:') || 0 === strpos($url, 'nntp:') || 0 === strpos($url, 'feed:') || 0 === strpos($url, 'cvs:') || 0 === strpos($url, 'ssh:') || 0 === strpos($url, 'git:') || 0 === strpos($url, 'svn:') || 0 === strpos($url, 'hg:'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -461,7 +461,7 @@ class UtilsTest extends \Codeception\TestCase\Test
|
||||
self::assertSame('pop://domain.com', Utils::url('pop://domain.com'));
|
||||
self::assertSame('foo://bar/baz', Utils::url('foo://bar/baz'));
|
||||
self::assertSame('foo://bar/baz', Utils::url('foo://bar/baz', true));
|
||||
// self::assertSame('mailto:joe@domain.com', Utils::url('mailto:joe@domain.com', true)); // FIXME <-
|
||||
self::assertSame('mailto:joe@domain.com', Utils::url('mailto:joe@domain.com', true)); // FIXME <-
|
||||
}
|
||||
|
||||
public function testUrlWithRoot(): void
|
||||
|
||||
Reference in New Issue
Block a user