summaryrefslogtreecommitdiff
path: root/app/controllers/snippets_controller.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-03-14 15:55:41 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-03-14 15:55:41 +0200
commita39eeba1dc631508ef4af7f26f4ba2e8cdea8bfe (patch)
treea47861aeee02caf9b19a55876e9025126990278f /app/controllers/snippets_controller.rb
parent17a9ecf8cf6724613b38c08040bdb786ffe30718 (diff)
downloadgitlab-ce-a39eeba1dc631508ef4af7f26f4ba2e8cdea8bfe.tar.gz
Render 404 instead of 500 if trying to see snippets of unexisting user
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/controllers/snippets_controller.rb')
-rw-r--r--app/controllers/snippets_controller.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb
index e54a968326f..0dd941a48e2 100644
--- a/app/controllers/snippets_controller.rb
+++ b/app/controllers/snippets_controller.rb
@@ -19,6 +19,9 @@ class SnippetsController < ApplicationController
def user_index
@user = User.find_by(username: params[:username])
+
+ render_404 and return unless @user
+
@snippets = @user.snippets.fresh.non_expired
if @user == current_user