Skip to content

Commit

Permalink
Escape brackets in field names before inserting to jQuery selector
Browse files Browse the repository at this point in the history
The recent upgrade of jQuery exposed an issue whereby field names such
as reporter_id[] were being used in jQuery selectors unescaped. This
particular issue occurred in the dynamic filter JavaScript code.
  • Loading branch information
davidhicks committed Mar 5, 2011
1 parent f86a9be commit e69926d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion javascript/bugFilter.js
Expand Up @@ -15,7 +15,8 @@ $(document).ready(function(){
}
});
$.each( form_fields, function (index, value) {
serialized_form_fields[value] = $('[name=filters_open]').find('[name=' + value.replace(/[]/g, '\\$1') + ']').serialize();
var escaped_field_name = value.replace(/\[\]/g, '\\[\\]');
serialized_form_fields[value] = $('[name=filters_open]').find('[name=' + escaped_field_name + ']').serialize();
});

/* Set up events to modify the form css to show when a stored query has been modified */
Expand Down

0 comments on commit e69926d

Please sign in to comment.