Commit 299eb60a authored by KR Moorhouse's avatar KR Moorhouse Committed by Kenny Hall

Added sanitization for list values upon update of the value. (#3454)

parent 3b9f83f0
......@@ -34,6 +34,15 @@ 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.
var findWhere = _.findWhere( fieldTypeData, { id: dataModel.get( 'type' ) } );
if( 'undefined' == typeof findWhere ) 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