Slugs that start with numbers parsed as IDs

http://site/some-slug gets redirected to http://site/some-slug/ID. That’s awesome.

But, http://site/21st-some-slug gets redirected to http://site/whatever-slug-it-is-for-id/21.

Is there a way to fix this? I’m poking around in routes.rb, thinking I could find a regex to change, but that doesn’t’ seem like the way.

5 Likes

Interesting, any ideas here @eviltrout? Probably a Rails routing thing.

That was trickier than I expected it to be, since it only fails when the topic whose id matches the same number exists. Here’s a fix:

https://github.com/discourse/discourse/commit/2766b2edc3fc68803d254d9039ca044e25a56d2e

6 Likes