Skip to content
Browse files

make sure to escape filter params and do proper splitting of those pa…

…rams
  • Loading branch information...
1 parent 17d5b28 commit 1d8872339cb998b9c93fa89858e6939ca9daf233 @paularmstrong paularmstrong committed Aug 15, 2011
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/parser.js
View
8 lib/parser.js
@@ -43,7 +43,7 @@ exports.parse = function (data, tags) {
part = parts[part];
filter_name = part.match(/^\w+/);
if (/\(/.test(part)) {
- filters.push({ name: filter_name[0], args: part.replace(/^\w+\(|\'|\"|,|\)$/g, '').split(' ') });
+ filters.push({ name: filter_name[0], args: part.replace(/^\w+\(|\'|\"|\)$/g, '').split(',') });
} else {
filters.push({ name: filter_name[0], args: [] });
}
@@ -101,9 +101,9 @@ function wrapFilter(variable, filter) {
if (filters.hasOwnProperty(filter.name)) {
args = [variable];
- if (filter.args.length) {
- args.push(filters.args);
- }
+ filter.args.forEach(function (f) {
+ args.push('\'' + f + '\'');
+ });
output = '__filters.' + filter.name + '.apply(this, [' + args.toString() + '])';
}

0 comments on commit 1d88723

Please sign in to comment.
Something went wrong with that request. Please try again.