Update URLSegmentFilter default_replacement ordering

Forward slashes, question marks, equal signs, hashes and colons were never actually be replaced with hyphens due to the order of this array.

The regex before it was always blasting it away.
This commit is contained in:
Hayden Shaw 2023-10-16 10:56:11 +13:00 committed by GitHub
parent 87958e7484
commit afde618db3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -35,8 +35,8 @@ class URLSegmentFilter implements FilterInterface
'/&/u' => '-and-',
'/\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, hashes and colons in case multibyte is allowed (and non-ASCII chars aren't removed)
'/[^A-Za-z0-9\-]+/u' => '', // remove non-ASCII chars, only allow alphanumeric and dashes
'/[\-]{2,}/u' => '-', // remove duplicate dashes
'/^[\-]+/u' => '', // Remove all leading dashes
'/[\-]+$/u' => '' // Remove all trailing dashes