User profile "top categories" URLs wrong for sub categories

AI-generated summary

A bug was reported where user profile ‘Top Categories’ links incorrectly generate URLs for subcategories, omitting the parent category path (e.g., c/icinga-2 instead of c/icinga/icinga-2). dnsmichi identified the issue, tracing it to a recent commit in git master. j.jaffeux initially asked if vinothkannans was involved, but neil confirmed they worked on the feature and took ownership. neil later pushed a fix, which dnsmichi confirmed resolved the issue after upgrading, expressing gratitude. The bug affected navigation from user profile summaries to subcategory pages, causing permission denied errors due to malformed URLs.

One of our users reported that the top categories in the user profile generate a permission denied error for their links.

My analysis and investigation is below, from what I can see this is a new feature in git master. add links to Top Categories on user summary page · discourse/discourse@8e5e7c6 · GitHub

Versions

Latest HEAD from today: https://github.com/discourse/discourse/compare/1ca999fdb58558171166e0dfbe10e10b374d3e33...tests-passed

Steps to reproduce

  • Navigate to a profile - Summary - Top Categories
  • Pick a category which is a sub category to a main one

Example

For example, my profile on https://monitoring-portal.org/u/dnsmichi/summary → “Icinga 2” is a sub category of “Icinga”.

The URL just contains the direct link but misses the /icinga in its path being the main category.

Wrong: https://monitoring-portal.org/c/icinga-2
Correct: https://monitoring-portal.org/c/icinga/icinga-2

Thanks for looking into it, I honestly don’t understand the code :slight_smile:

5 Likes

@vinothkannans is it related to your recent work? If not I can give it a look by tomorrow.

I worked on that so I can look.

5 Likes

I pushed a fix for this.

9 Likes

Awesome, thank you. Upgraded now to latest and works like a charm :heart:

2 Likes