Skip to content

Commit

Permalink
Redirect to home page on a missing document. Fixes #561
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed May 14, 2013
1 parent 946e6e8 commit 18223eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
12 changes: 4 additions & 8 deletions lib/blacklight/catalog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -299,14 +299,10 @@ def rsolr_request_error(exception)

# when a request for /catalog/BAD_SOLR_ID is made, this method is executed...
def invalid_solr_id_error
if Rails.env == "development"
render # will give us the stack trace
else
flash[:notice] = I18n.t('blacklight.search.errors.invalid_solr_id')
params.delete(:id)
index
render "index", :status => 404
end
flash[:notice] = I18n.t('blacklight.search.errors.invalid_solr_id')
params.delete(:id)
index
render "index", :status => 404
end

def blacklight_solr
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/catalog_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ def export_as_mock
:get_single_doc_via_search => @mock_document)
get :show, :id=>"987654321"
request.flash[:notice].should == "Sorry, you have requested a record that doesn't exist."
response.should_not be_success
response.should render_template('index')
response.status.should == 404
end
it "should redirect the user to the root url for a bad search" do
Expand Down

0 comments on commit 18223eb

Please sign in to comment.