Project

General

Profile

Defect #5676 ยป 5676_large_integer_search.diff

Holger Just, 2010-06-20 21:20

View differences:

app/controllers/search_controller.rb
43 43
    begin; offset = params[:offset].to_time if params[:offset]; rescue; end
44 44
    
45 45
    # quick jump to an issue
46
    if @question.match(/^#?(\d+)$/) && Issue.visible.find_by_id($1)
46
    if @question.match(/^#?(\d+)$/) && $1.to_i <= 2147483647 && Issue.visible.find_by_id($1)
47 47
      redirect_to :controller => "issues", :action => "show", :id => $1
48 48
      return
49 49
    end
test/functional/search_controller_test.rb
134 134
    assert_template 'index'
135 135
  end
136 136
  
137
  def test_large_integer
138
    get :index, :q => '4615713488'
139
    assert_response :success
140
    assert_template 'index'
141
  end
142
  
137 143
  def test_tokens_with_quotes
138 144
    get :index, :id => 1, :q => '"good bye" hello "bye bye"'
139 145
    assert_equal ["good bye", "hello", "bye bye"], assigns(:tokens)
    (1-1/1)