From: Tom Hughes Date: Thu, 9 Aug 2007 07:45:04 +0000 (+0000) Subject: Return "404 Not Found" for users and traces which don't exist. X-Git-Tag: live~8249 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/183841d10e7acbb6dad17cc7cc3283817d44164b Return "404 Not Found" for users and traces which don't exist. --- diff --git a/app/controllers/trace_controller.rb b/app/controllers/trace_controller.rb index de8b17f30..b758d0c40 100644 --- a/app/controllers/trace_controller.rb +++ b/app/controllers/trace_controller.rb @@ -88,6 +88,8 @@ class TraceController < ApplicationController render :nothing, :status => :forbidden if @trace.user.id != @user.id end end + rescue ActiveRecord::RecordNotFound + render :nothing => true, :status => :not_found end def create diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 0042be316..d945e53a2 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -172,7 +172,12 @@ class UserController < ApplicationController def view @this_user = User.find_by_display_name(params[:display_name]) - @title = @this_user.display_name + + if @this_user + @title = @this_user.display_name + else + render :nothing => true, :status => :not_found + end end def make_friend