FIX: ensure that we encode a slug only once if slug generation method is encoded
This was re-encoding the search slug each loop - if the category list was not the first category in the list, it'd continually search with a re-encoded search term from the previous iteration. This results in ember 404ing when navigating to raw encoded category slugs of the form /c/encoded-slug-with-non-ascii that have no ID attached.
This commit is contained in:
parent
eca1c643d5
commit
e36efb1edc
|
@ -308,11 +308,10 @@ Category.reopenClass({
|
|||
},
|
||||
|
||||
findBySlugAndParent(slug, parentCategory) {
|
||||
if (Discourse.SiteSettings.slug_generation_method === "encoded") {
|
||||
slug = encodeURI(slug);
|
||||
}
|
||||
return Category.list().find(category => {
|
||||
if (Discourse.SiteSettings.slug_generation_method === "encoded") {
|
||||
slug = encodeURI(slug);
|
||||
}
|
||||
|
||||
return (
|
||||
category.slug === slug &&
|
||||
(category.parentCategory || null) === parentCategory
|
||||
|
|
Loading…
Reference in New Issue