addition to #685 also, respect mb in controller

This commit is contained in:
Lukas Erni 2023-11-20 15:25:04 +01:00
parent 1d901be802
commit d6375c5048

View File

@ -11,6 +11,8 @@ use SilverStripe\ORM\DataList;
use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\ORM\PaginatedList; use SilverStripe\ORM\PaginatedList;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;
use SilverStripe\Blog\Model\BlogTag;
use SilverStripe\Blog\Model\BlogCategory;
use SilverStripe\View\Parsers\URLSegmentFilter; use SilverStripe\View\Parsers\URLSegmentFilter;
use SilverStripe\Control\HTTPRequest; use SilverStripe\Control\HTTPRequest;
@ -268,6 +270,7 @@ class BlogController extends PageController
$tag = $this->request->param('Tag'); $tag = $this->request->param('Tag');
if ($tag) { if ($tag) {
$filter = URLSegmentFilter::create(); $filter = URLSegmentFilter::create();
$filter->setAllowMultibyte(BlogTag::config()->get('allow_urlsegment_multibyte'));
// url encode unless it's multibyte (already pre-encoded in the database) // url encode unless it's multibyte (already pre-encoded in the database)
// see https://github.com/silverstripe/silverstripe-cms/pull/2384 // see https://github.com/silverstripe/silverstripe-cms/pull/2384
if (!$filter->getAllowMultibyte()) { if (!$filter->getAllowMultibyte()) {
@ -318,6 +321,7 @@ class BlogController extends PageController
$category = $this->request->param('Category'); $category = $this->request->param('Category');
if ($category) { if ($category) {
$filter = URLSegmentFilter::create(); $filter = URLSegmentFilter::create();
$filter->setAllowMultibyte(BlogCategory::config()->get('allow_urlsegment_multibyte'));
// url encode unless it's multibyte (already pre-encoded in the database) // url encode unless it's multibyte (already pre-encoded in the database)
// see https://github.com/silverstripe/silverstripe-cms/pull/2384 // see https://github.com/silverstripe/silverstripe-cms/pull/2384
if (!$filter->getAllowMultibyte()) { if (!$filter->getAllowMultibyte()) {