X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/ac80723058ab4c86e6bf024e0c75b60ab6c59624..refs/pull/255/head:/app/Repos/ChapterRepo.php diff --git a/app/Repos/ChapterRepo.php b/app/Repos/ChapterRepo.php index 96f5b2d1e..4c13b9aaf 100644 --- a/app/Repos/ChapterRepo.php +++ b/app/Repos/ChapterRepo.php @@ -150,8 +150,7 @@ class ChapterRepo extends EntityRepo */ public function findSuitableSlug($name, $bookId, $currentId = false) { - $slug = Str::slug($name); - if ($slug === "") $slug = substr(md5(rand(1, 500)), 0, 5); + $slug = $this->nameToSlug($name); while ($this->doesSlugExist($slug, $bookId, $currentId)) { $slug .= '-' . substr(md5(rand(1, 500)), 0, 3); }