NOW MANAGED ON CODEBERG
Added test to cover multi-byte slugs
Dan Brownf0948377096d
diff --git a/app/Repos/EntityRepo.php b/app/Repos/EntityRepo.phpindex 25d229be1..944c0bcfc 100644--- a/app/Repos/EntityRepo.php+++ b/app/Repos/EntityRepo.php@@ -553,7 +553,7 @@ class EntityRepo*/protected function nameToSlug($name){- $slug = str_replace(' ', '-', function_exists('mb_strtolower') ? mb_strtolower($name) : strtolower($name));+ $slug = str_replace(' ', '-', mb_strtolower($name));$slug = preg_replace('/[\+\/\\\?\@\}\{\.\,\=\[\]\#\&\!\*\'\;\:\$\%]/', '', $slug);if ($slug === "") $slug = substr(md5(rand(1, 500)), 0, 5);return $slug;diff --git a/tests/Entity/EntityTest.php b/tests/Entity/EntityTest.phpindex 07f1926c5..3f23475a0 100644--- a/tests/Entity/EntityTest.php+++ b/tests/Entity/EntityTest.php@@ -257,4 +257,15 @@ class EntityTest extends BrowserKitTest->seeInElement('#recently-updated-pages', $page->name);}+ public function test_slug_multi_byte_lower_casing()+ {+ $entityRepo = app(EntityRepo::class);+ $book = $entityRepo->createFromInput('book', [+ 'name' => 'КНИГА'+ ]);++ $this->assertEquals('книга', $book->slug);+ }++}