Not able to create a permalink with forums/* address

AI-generated summary

User mrded reported a bug where creating a Permalink with a path containing a slash (e.g., forums/general-discussion) to redirect to a Category resulted in an AbstractController::ActionNotFound error. The issue stemmed from the router processing all /forums/* requests, preventing the specific permalink action from being found. mrded noted they were using this for migration redirects from an external forum. Falco initially suggested that permalinks should not accept the / character as it is a delimiter, though later clarified that paths like a/b/c do function correctly and the specific error required further investigation. mrded asked for clarification on why the slash was problematic, but confirmed the issue was resolved via a pull request (mrded). The solution involved a code change submitted to the Discourse repository here, allowing the desired redirect structure to work as intended.

I’m trying to create a Permalink with forums/general-discussion url pointing to a Category.

Then I try to access it - it gives me an error:

AbstractController::ActionNotFound at /forums/general-discussion
The action 'show' could not be found for ForumsController

The problem is with routers:

Discourse::Application.routes.draw do
  ...
  resources :forums
  ...
end

it processes all /forums/* requests.

I made a pull request here Remove useless routing for ForumsController by mrded · Pull Request #4517 · discourse/discourse · GitHub

1 me gusta

A permalink shouldn’t accept the “/” character because that’s invalid for a location, because its a delimiter.

One permalink as “general-discussion” should work.

Are you in a subfolder install?

Thank you for your answer,

I’m using Permalink as redirects from the forum we are migrating from.

And we have to redirect from http://example.com/forums/general-discussion into http://example.com/c/uncategorized

Currently I’m on local development install http://localhost:3000/.

The issue has been solved, but still, can you explain why a permalink shouldn’t accept the “/” character?
Am I using it not on purpose? Thanks.

Actually a permalink with a/b/c works, and one with c/xyz also works. Gotta do some digging on this later.

Do not worry about it, it’s solved already Remove useless routing for ForumsController by mrded · Pull Request #4517 · discourse/discourse · GitHub

Thanks.

4 Me gusta