mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 08:43:25 +08:00
FIX: category routes model params should decode their URL parts (#8612)
* FIX: category routes model params should decode their URL parts Ember's route star globbing does not uri decode by default. This is problematic for subcategory globs with encoded URL site settings enabled. Subcategories with encoded URLs will 404 without this decode. I found this https://github.com/tildeio/route-recognizer/pull/91 which explicitly explains that globbing does not decode automatically.
This commit is contained in:
parent
e36efb1edc
commit
63323bd7a8
|
@ -334,7 +334,11 @@ Category.reopenClass({
|
|||
},
|
||||
|
||||
findBySlugPathWithID(slugPathWithID) {
|
||||
const parts = slugPathWithID.split("/");
|
||||
let parts = slugPathWithID.split("/");
|
||||
// slugs found by star/glob pathing in emeber do not automatically url decode - ensure that these are decoded
|
||||
if (Discourse.SiteSettings.slug_generation_method === "encoded") {
|
||||
parts = parts.map(urlPart => decodeURI(urlPart));
|
||||
}
|
||||
let category = null;
|
||||
|
||||
if (parts.length > 0 && parts[parts.length - 1].match(/^\d+$/)) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user