FIX: Make category slugs lowercase (#11277)

Admins could specify category slug with upper case characters and same slug,
but with different cases could be used simultaneously.
This commit is contained in:
Bianca Nenciu
2021-01-12 17:28:33 +02:00
committed by GitHub
parent e80332a2bc
commit ec0212e56b
7 changed files with 118 additions and 30 deletions

View File

@@ -29,14 +29,6 @@ describe CategoryHashtag do
expect(Category.query_from_hashtag_slug("non-existent#{CategoryHashtag::SEPARATOR}#{parent_category.slug}")).to eq(nil)
end
it "should be case sensitive" do
parent_category.update!(slug: "ApPlE")
child_category.update!(slug: "OraNGE")
expect(Category.query_from_hashtag_slug("apple")).to eq(nil)
expect(Category.query_from_hashtag_slug("apple#{CategoryHashtag::SEPARATOR}orange")).to eq(nil)
end
context "multi-level categories" do
before do
SiteSetting.max_category_nesting = 3