Commit a39eeba1dc631508ef4af7f26f4ba2e8cdea8bfe
1 parent
17a9ecf8
Exists in
spb-stable
and in
3 other branches
Render 404 instead of 500 if trying to see snippets of unexisting user
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
1 changed file
with
3 additions
and
0 deletions
Show diff stats
app/controllers/snippets_controller.rb
... | ... | @@ -19,6 +19,9 @@ class SnippetsController < ApplicationController |
19 | 19 | |
20 | 20 | def user_index |
21 | 21 | @user = User.find_by(username: params[:username]) |
22 | + | |
23 | + render_404 and return unless @user | |
24 | + | |
22 | 25 | @snippets = @user.snippets.fresh.non_expired |
23 | 26 | |
24 | 27 | if @user == current_user | ... | ... |