FIX: Generate category url correctly when slugs are empty

FIX: Generate category url correctly when slugs are empty

diff --git a/app/models/category.rb b/app/models/category.rb
index 74a6d87fb5..8c216ac687 100644
--- a/app/models/category.rb
+++ b/app/models/category.rb
@@ -661,8 +661,8 @@ class Category < ActiveRecord::Base
     url = @@url_cache[self.id]
     unless url
       url = +"#{Discourse.base_uri}/c"
-      url << "/#{parent_category.slug}" if parent_category_id
-      url << "/#{slug}"
+      url << "/#{parent_category.slug_for_url}" if parent_category_id
+      url << "/#{slug_for_url}"
       @@url_cache[self.id] = -url
     end

GitHub sha: cacf99e1

1 Like

I think that’s worth a small unit test.

1 Like