Add validation for maximum ID passed to changesets#index
This commit is contained in:
parent
e3c43e4a1a
commit
d8b468e7a1
2 changed files with 11 additions and 0 deletions
|
@ -18,6 +18,8 @@ class ChangesetsController < ApplicationController
|
||||||
##
|
##
|
||||||
# list non-empty changesets in reverse chronological order
|
# list non-empty changesets in reverse chronological order
|
||||||
def index
|
def index
|
||||||
|
param! :max_id, Integer, :min => 1
|
||||||
|
|
||||||
@params = params.permit(:display_name, :bbox, :friends, :nearby, :max_id, :list)
|
@params = params.permit(:display_name, :bbox, :friends, :nearby, :max_id, :list)
|
||||||
|
|
||||||
if request.format == :atom && @params[:max_id]
|
if request.format == :atom && @params[:max_id]
|
||||||
|
|
|
@ -92,6 +92,15 @@ class ChangesetsControllerTest < ActionDispatch::IntegrationTest
|
||||||
check_index_result(changesets.last(20))
|
check_index_result(changesets.last(20))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# This should report an error
|
||||||
|
def test_index_invalid_xhr
|
||||||
|
%w[-1 0 fred].each do |id|
|
||||||
|
get history_path(:format => "html", :list => "1", :max_id => id)
|
||||||
|
assert_redirected_to :controller => :errors, :action => :bad_request
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# This should display the last 20 changesets closed in a specific area
|
# This should display the last 20 changesets closed in a specific area
|
||||||
def test_index_bbox
|
def test_index_bbox
|
||||||
|
|
Loading…
Add table
Reference in a new issue