FIX: Failed to detect existing category permalink

approved

#1

FIX: Failed to detect existing category permalink

diff --git a/app/models/category.rb b/app/models/category.rb
index 5949b4a..96c9a09 100644
--- a/app/models/category.rb
+++ b/app/models/category.rb
@@ -585,6 +585,7 @@ class Category < ActiveRecord::Base
     url = +"#{Discourse.base_uri}/c"
     url << "/#{parent_category.slug}" if parent_category_id
     url << "/#{old_slug}"
+    url = Permalink.normalize_url(url)
 
     if Permalink.where(url: url).exists?
       Permalink.where(url: url).update_all(category_id: id)

GitHub sha: f3c76ad4


DEV: Add spec for reusing category permalink
#2

I think that’s worth a test.


Follow Up #3

Followed Up #5

DEV: Add spec for reusing category permalink


Approved #6