mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Remove redundant underscore and update the comment
This commit is contained in:
parent
c74137e679
commit
1795b21df0
@ -33,7 +33,7 @@ class URLSegmentFilter extends Object {
|
|||||||
'/[_.]+/u' => '-', // underscores and dots to dashes
|
'/[_.]+/u' => '-', // underscores and dots to dashes
|
||||||
'/[^A-Za-z0-9\-]+/u' => '', // remove non-ASCII chars, only allow alphanumeric and dashes
|
'/[^A-Za-z0-9\-]+/u' => '', // remove non-ASCII chars, only allow alphanumeric and dashes
|
||||||
'/[\-]{2,}/u' => '-', // remove duplicate dashes
|
'/[\-]{2,}/u' => '-', // remove duplicate dashes
|
||||||
'/^[\-_]/u' => '', // Remove all leading dashes or underscores
|
'/^[\-]+/u' => '' // Remove all leading dashes
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,4 +77,9 @@ class URLSegmentFilterTest extends SapphireTest {
|
|||||||
$this->assertEquals('url-contains-dot', $filter->filter('url-contains.dot'));
|
$this->assertEquals('url-contains-dot', $filter->filter('url-contains.dot'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testRemoveLeadingDashes() {
|
||||||
|
$filter = new URLSegmentFilter();
|
||||||
|
$this->assertEquals('url-has-leading-dashes', $filter->filter('---url-has-leading-dashes'));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user