summaryrefslogtreecommitdiff
path: root/users/app/controllers/keys_controller.rb
diff options
context:
space:
mode:
authorjessib <jessib@riseup.net>2013-11-25 11:31:33 -0800
committerjessib <jessib@riseup.net>2013-11-25 11:31:33 -0800
commit299dfdf4164ee10de63aa2543935eeed65437b3f (patch)
tree13f878e171d1cbbbcc82f5e40c91db145017efb2 /users/app/controllers/keys_controller.rb
parentd82ea5da2aa705bcfa74f2a8b42a197883b694e3 (diff)
Give 404 error if one goes to /key/user for non-existing user.
Diffstat (limited to 'users/app/controllers/keys_controller.rb')
-rw-r--r--users/app/controllers/keys_controller.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/users/app/controllers/keys_controller.rb b/users/app/controllers/keys_controller.rb
index 9a39fc4..949f2c0 100644
--- a/users/app/controllers/keys_controller.rb
+++ b/users/app/controllers/keys_controller.rb
@@ -3,8 +3,10 @@ class KeysController < ApplicationController
def show
user = User.find_by_login(params[:login])
# layout won't be included if we render text
- # we will show blank page if user doesn't have key or user doesn't exist
- render text: user ? user.public_key : ''
+ # we will show blank page if user doesn't have key (which shouldn't generally occur)
+ # and a 404 error if user doesn't exist
+ user ? (render text: user.public_key) : (raise ActionController::RoutingError.new('Not Found'))
+
end
end