Updated regex for BuildList#prepare_extra_params

This commit is contained in:
Vokhmin Alexey V 2014-10-23 22:52:38 +04:00
parent e4f5af6707
commit 3ac550d7a1
2 changed files with 2 additions and 2 deletions

View File

@ -748,7 +748,7 @@ class BuildList < ActiveRecord::Base
params = extra_params.slice(*BuildList::EXTRA_PARAMS)
params.update(params) do |k,v|
v.strip.gsub(I18n.t("activerecord.attributes.build_list.extra_params.#{k}"), '').
gsub(/[^\w\s\-["']]/, '')
gsub(/[^\w\s\-["]]/, '')
end
self.extra_params = params.select{ |k,v| v.present? }
end

View File

@ -343,7 +343,7 @@ describe BuildList do
it 'removes unsafe symbols' do
build_list.extra_params = { 'build_rpm' => '--test \'001\' --define "cross armv7hl"{(@' }
build_list.send :prepare_extra_params
expect(build_list.extra_params['build_rpm']).to eq '--test \'001\' --define "cross armv7hl"'
expect(build_list.extra_params['build_rpm']).to eq '--test 001 --define "cross armv7hl"'
end
end