From 41d9a911f0dfc88bd22e2e09abf6b4c4c1a2bec4 Mon Sep 17 00:00:00 2001 From: Tulio Casagrande Date: Thu, 2 Mar 2017 14:54:52 -0300 Subject: Fix keys route to accept usernames with dots --- config/routes.rb | 2 +- test/functional/keys_controller_test.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index b152c9c..d388ab7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -58,6 +58,6 @@ LeapWeb::Application.routes.draw do get "/.well-known/host-meta" => 'webfinger#host_meta' get "/webfinger" => 'webfinger#search' - get "/key/:login" => 'keys#show' + get "/key/:login" => 'keys#show', :constraints => { :login => /[^\/]+/ } end diff --git a/test/functional/keys_controller_test.rb b/test/functional/keys_controller_test.rb index 863be93..f5e2691 100644 --- a/test/functional/keys_controller_test.rb +++ b/test/functional/keys_controller_test.rb @@ -2,6 +2,10 @@ require 'test_helper' class KeysControllerTest < ActionController::TestCase + test "get key for username with dot" do + assert_recognizes({controller: 'keys', action: 'show', login: 'username.with.dot'}, 'key/username.with.dot') + end + test "get existing public key" do public_key = 'my public key' @user = stub_record :user, :public_key => public_key -- cgit v1.2.3