Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String filters break when argument has reserved regex characters #89

Closed
timdmackey opened this issue Sep 6, 2018 · 1 comment
Closed
Labels

Comments

@timdmackey
Copy link

timdmackey commented Sep 6, 2018

String filters such as split, remove, and replace break when the filter argument has one of the following special characters in it:

[ ( ) |

Note that paired brackets [] and parentheses () do not break the regex filter. Other special characters \ ^ $ . | ? * + { } do not seem to throw an error, but since they are unescaped they could potentially cause unexpected results.

LiquidJS should have some sort of escaping function to prevent this from happening.

Note that this testing was down with the browser based version of liquidjs (https://unpkg.com/liquidjs@6.0.0/dist/liquid.min.js)

@harttle
Copy link
Owner

harttle commented Jan 28, 2019

It's a bug related to the tokenizer, which treats | as filter separator literally. That tokenizer should be rewritten into a state of the art fashion as well.

Here's a jsbin demo: https://jsbin.com/jiyegez/edit?html,output

harttle pushed a commit that referenced this issue Feb 23, 2019
## [7.2.2](v7.2.1...v7.2.2) (2019-02-23)

### Bug Fixes

* filters break when argument contains [()|, fixes [#89](#89) ([e977669](e977669))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants