Commit 0cb5a733 authored by KR Moorhouse's avatar KR Moorhouse Committed by Kenny Hall

Updated sanitization to only fire on FIeld objects. (#3455)

parent a033cbeb
......@@ -34,16 +34,18 @@ define( [ 'models/app/optionRepeaterCollection' ], function( ListOptionCollectio
},
updateOptionValue: function( e, model, dataModel, settingModel, optionView ) {
var newVal = model.get( 'value' );
// Sanitize any unwanted special characters.
// TODO: This assumes English is the standard language.
// We might want to allow other language characters through this check later.
var pattern = /[^0-9a-zA-Z_@.-]/g;
newVal = newVal.replace( pattern, '' );
model.set( 'value', newVal );
// Re-render the value.
optionView.render();
if ( 'Field' == dataModel.get( 'objectType' ) ) {
var newVal = model.get( 'value' );
// Sanitize any unwanted special characters.
// TODO: This assumes English is the standard language.
// We might want to allow other language characters through this check later.
var pattern = /[^0-9a-zA-Z_@.-]/g;
newVal = newVal.replace( pattern, '' );
model.set( 'value', newVal );
// Re-render the value.
optionView.render();
}
var findWhere = _.findWhere( fieldTypeData, { id: dataModel.get( 'type' ) } );
if( 'undefined' == typeof findWhere ) return;
if( 'list' != findWhere.parentType ) return;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment