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

missed filter not throwing parse error #271

Closed
palsorbo opened this issue Nov 25, 2020 · 4 comments
Closed

missed filter not throwing parse error #271

palsorbo opened this issue Nov 25, 2020 · 4 comments

Comments

@palsorbo
Copy link

Hii !

Facing an issue can you help me out.

Running {{ data_due_date | default:'Nov 30' date:'%b %d' }} template on liqp throws parse error.

Exception in thread "main" liqp.exceptions.LiquidException: parser error "extraneous input 'date' expecting {OutEnd, '|'}" on line 1, index 36.

But running the same template with liquidjs engine throws no parse error. Is this a bug?

Thank you.

@harttle
Copy link
Owner

harttle commented Nov 25, 2020

There is a strictFilters option available, here's a demo: https://jsfiddle.net/kxetzqh5/

@palsorbo
Copy link
Author

palsorbo commented Nov 25, 2020

Hey, thank you for the quick response.

Here added a demo: https://jsfiddle.net/sarbajit/hrxmsedp/7/

In the second h3 tag the parsing fails in Liqp.

@harttle
Copy link
Owner

harttle commented Nov 28, 2020

Thank you for clarification. If I understand correctly, it's about how to handle invalid filter syntax. The content of the second h3 in the jsfiddle above is:

{{ age | default: 'now'  date: '%d'}}    // missing `|` before `date`
  • shopify/liquid throws wrong number of arguments
  • liqp throws parser error "extraneous input 'date'
  • liquidjs just skips the intended date filter

It's indeed invalid syntax, so I'm considering throw an ParseError maybe something like invalid filter argument or unexpected ":" and it should be thrown regardless the value of strictFilters.

@harttle harttle closed this as completed in 01014ed Mar 5, 2022
github-actions bot pushed a commit that referenced this issue Mar 5, 2022
# [9.36.0](v9.35.2...v9.36.0) (2022-03-05)

### Features

* Access array item by negative index, closes [#486](#486) ([049685b](049685b))
* allow strip filter with specified char, closes [#390](#390) ([c503cb2](c503cb2))
* appropriate error for malformed filters, fixes [#271](#271) ([01014ed](01014ed))
@github-actions
Copy link

github-actions bot commented Mar 5, 2022

🎉 This issue has been resolved in version 9.36.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants