Skip to content

Fix keys route to accept usernames with dots

Tulio Casagrande requested to merge (removed):username-with-dot into master

We are having a problem when getting the key for usernames with dots (https://leap.se/code/issues/8709).

Dec 27 18:12:39 pixelated webapp8311: Started GET "/key/thais.siqueira" for 0.0.0.0 at 2016-12-27 18:12:39 +0000
Dec 27 18:12:39 pixelated webapp8311: Processing by KeysController#show as
Dec 27 18:12:39 pixelated webapp8311: Parameters: {"login"=>"thais"}

To fix it, we followed rails documentation as described here http://guides.rubyonrails.org/routing.html#specifying-constraints:

By default the :id parameter doesn't accept dots - this is because the dot is used as a separator for formatted routes. If you need to use a dot within an :id add a constraint which overrides this - for example id: /[^/]+/ allows anything except a slash.

Merge request reports

Loading