mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
URLSegmentFilter: Remove : characters from url segments when multibyte characters are allowed.
This commit is contained in:
parent
0520d77461
commit
9184056b5e
@ -36,7 +36,7 @@ class URLSegmentFilter
|
||||
'/\s|\+/u' => '-', // remove whitespace/plus
|
||||
'/[_.]+/u' => '-', // underscores and dots to dashes
|
||||
'/[^A-Za-z0-9\-]+/u' => '', // remove non-ASCII chars, only allow alphanumeric and dashes
|
||||
'/[\/\?=#]+/u' => '-', // remove forward slashes, question marks, equal signs and hashes in case multibyte is allowed (and non-ASCII chars aren't removed)
|
||||
'/[\/\?=#:]+/u' => '-', // remove forward slashes, question marks, equal signs, hashes and colons in case multibyte is allowed (and non-ASCII chars aren't removed)
|
||||
'/[\-]{2,}/u' => '-', // remove duplicate dashes
|
||||
'/^[\-]+/u' => '', // Remove all leading dashes
|
||||
'/[\-]+$/u' => '' // Remove all trailing dashes
|
||||
|
@ -113,6 +113,6 @@ class URLSegmentFilterTest extends SapphireTest
|
||||
{
|
||||
$filter = new URLSegmentFilter();
|
||||
$filter->setAllowMultibyte(true);
|
||||
$this->assertEquals('url-with-bad-characters', $filter->filter('url?-with/-bad#-characters='));
|
||||
$this->assertEquals('url-with-some-bad-characters', $filter->filter('url?-with/-some:-bad#-characters='));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user