mirror of
https://github.com/redmine/redmine.git
synced 2025-11-06 13:25:44 +01: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:
@@ -27,7 +27,7 @@ module Redmine
|
|||||||
super
|
super
|
||||||
callback = request.params[:callback] || request.params[:jsonp]
|
callback = request.params[:callback] || request.params[:jsonp]
|
||||||
if callback && Setting.jsonp_enabled?
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -52,11 +52,11 @@ class Redmine::ApiTest::JsonpTest < Redmine::ApiTest::Base
|
|||||||
|
|
||||||
def test_jsonp_should_strip_invalid_characters_from_callback
|
def test_jsonp_should_strip_invalid_characters_from_callback
|
||||||
with_settings :jsonp_enabled => '1' do
|
with_settings :jsonp_enabled => '1' do
|
||||||
get '/trackers.json?callback=+-aA$1_'
|
get '/trackers.json?callback=+-aA$1_.'
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_response :success
|
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']
|
assert_equal 'application/javascript; charset=utf-8', response.headers['Content-Type']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user