]> source.dussan.org Git - redmine.git/commitdiff
Typecast issue ids when searched for.
authorEric Davis <edavis@littlestreamsoftware.com>
Sun, 20 Jun 2010 20:01:32 +0000 (20:01 +0000)
committerEric Davis <edavis@littlestreamsoftware.com>
Sun, 20 Jun 2010 20:01:32 +0000 (20:01 +0000)
Older Postgres versions don't allow searching over the id field's max size.

Contributed by Holger Just

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3806 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/search_controller.rb
test/functional/search_controller_test.rb

index 0f0a4e6aec3bc78cd7b4f850547f72e2011e268f..f2e146b2f554a2b61081c80ef429607a8d6d261b 100644 (file)
@@ -43,7 +43,7 @@ class SearchController < ApplicationController
     begin; offset = params[:offset].to_time if params[:offset]; rescue; end
     
     # quick jump to an issue
-    if @question.match(/^#?(\d+)$/) && Issue.visible.find_by_id($1)
+    if @question.match(/^#?(\d+)$/) && Issue.visible.find_by_id($1.to_i)
       redirect_to :controller => "issues", :action => "show", :id => $1
       return
     end
index b062468a60e64b98b41afdd9615f72bd6e9ca593..58e3ca8815105623447db9189e73f5e4b7b0ec5c 100644 (file)
@@ -133,6 +133,12 @@ class SearchControllerTest < ActionController::TestCase
     assert_response :success
     assert_template 'index'
   end
+
+  def test_large_integer
+    get :index, :q => '4615713488'
+    assert_response :success
+    assert_template 'index'
+  end
   
   def test_tokens_with_quotes
     get :index, :id => 1, :q => '"good bye" hello "bye bye"'