mirror of
https://github.com/redmine/redmine.git
synced 2024-09-13 15:45:44 +02:00
Accept dots in JSONP callback (#13718).
git-svn-id: http://svn.redmine.org/redmine/trunk@15066 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
9adf2cb0ea
commit
aaeb0807bf
@ -27,7 +27,7 @@ module Redmine
|
||||
super
|
||||
callback = request.params[:callback] || request.params[:jsonp]
|
||||
if callback && Setting.jsonp_enabled?
|
||||
self.jsonp = callback.to_s.gsub(/[^a-zA-Z0-9_]/, '')
|
||||
self.jsonp = callback.to_s.gsub(/[^a-zA-Z0-9_.]/, '')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -52,11 +52,11 @@ class Redmine::ApiTest::JsonpTest < Redmine::ApiTest::Base
|
||||
|
||||
def test_jsonp_should_strip_invalid_characters_from_callback
|
||||
with_settings :jsonp_enabled => '1' do
|
||||
get '/trackers.json?callback=+-aA$1_'
|
||||
get '/trackers.json?callback=+-aA$1_.'
|
||||
end
|
||||
|
||||
assert_response :success
|
||||
assert_match %r{^aA1_\(\{"trackers":.+\}\)$}, response.body
|
||||
assert_match %r{^aA1_.\(\{"trackers":.+\}\)$}, response.body
|
||||
assert_equal 'application/javascript; charset=utf-8', response.headers['Content-Type']
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user