Left clicking permalink for renamed category does not work

Left clicking a permalink that you have linked to from a post does not work.

Steps to reproduce from new development vagrant instance running latest master branch:

  1. Make a post that has a link the lounge category (/c/lounge)
  2. Edit the lounge category to be lounge2, which creates a permalink for /c/lounge
  3. Try left clicking on the link you made in step 1

You should see this error message:

Here is the console log:

ember:5732 DEBUG: -------------------------------
ember:5732 DEBUG: Ember  : 2.10.0
ember:5732 DEBUG: jQuery : 2.2.0
ember:5732 DEBUG: -------------------------------
ember:5732 DEBUG: For more advanced debugging, install the Ember Inspector from https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi
http://192.168.0.86:4000/c/lounge/find_by_slug.json?_=1484680046186 Failed to load resource: the server responded with a status of 403 (Forbidden)
discourse/routes/application:86 Object
error @ discourse/routes/application:86
ember:27784 Error while processing route: discovery.parentCategory
logError @ ember:27784
ember:16911 Error: Forbidden
    at unwrapErrorThrown (ember:30421:15)
    at errorFor (ember:30403:14)
    at onerrorDefault (ember:30393:17)
    at Object.trigger (ember:57841:9)
    at eval (ember:58725:26)
    at invoke (ember:339:14)
    at Queue.flush (ember:407:9)
    at DeferredActionQueues.flush (ember:531:15)
    at Backburner.end (ember:601:23)
    at Backburner.run (ember:724:16)
defaultDispatch @ ember:16911
lounge2:192 Uncaught promise:  Object

Refreshing the page, or middle clicking the link works.

I am not sure this is a bug, if you rename the category why would you expect old links to the previous name to still work?

Because Discourse automatically makes a “Permalink”, a URL redirect, when you rename a category. The point of this bug isn’t about renaming categories. All Permalinks do not work in the same way.

I did some more testing. The bug is worse for permalinks that inhabit the same namespace as categories (e.g. “c/lounge”). If you make a permalink that doesn’t inhabit any special namespace (e.g. one with the URL “permalink1”), you get the standard broken “Oops! That page doesn’t exist or is private.” when you left click on it in a forum post. cc @eviltrout

By the way, the non-special route permalinks being broken is another example of a bug that would be fixed by my PR that causes a server-side refresh on an unknown route:

https://github.com/discourse/discourse/pull/4645

@codinghorror Unless something changed recently, your edit of the title of this thread is not accurate. This issue affects all permalinks. Left clicking any permalink doesn’t work. The category renaming was just an example.

Bumping this since I get the same error on latest Discourse.

Fixed here?

That bugfix looks only related to categories in subfolder installs not permalink fixing. As I mentioned above the title of this topic was incorrectly changed to be more specific than it is. This problem effects all permalinks.