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

Unexpected errors on empty filters #970

Closed
f6p opened this issue Dec 1, 2017 · 4 comments
Closed

Unexpected errors on empty filters #970

f6p opened this issue Dec 1, 2017 · 4 comments

Comments

@f6p
Copy link

f6p commented Dec 1, 2017

Hello,

after recent haml update (from 4.0.7 to 5.0.4) I noticed that filters may raise unexpected errors when there is no content. For example in 4.0 it was safe to have :css with no content. After update to 5.0 when :css have no content css filter will receive nil as text argument and will fail trying to do text.rstrip.

text = text.rstrip

It looks like previously strings were passed to filters but now if there is no content filter will receive nil instead. So some filters will raise unexpected errors while others won't depending on how they are implemented.

@dillonwelch
Copy link
Contributor

It seems like maybe this could be solved with a deprecation warning/error? It shouldn't be surprising that major version upgrades come with breaking changes.

@k0kubun
Copy link
Member

k0kubun commented Jun 21, 2020

Could you provide a minimum template which reproduces the problem? I haven't been able to reproduce your problem so far.

$ cat a.haml
:css
$ haml -v
Haml 5.1.2
$ haml a.haml
<style>

</style>

@k0kubun
Copy link
Member

k0kubun commented Jun 21, 2020

Well, looks like I merged a patch which fixed the issue 😅 #986

@k0kubun k0kubun closed this as completed Jun 21, 2020
@k0kubun
Copy link
Member

k0kubun commented Jun 21, 2020

So please try the latest Haml.

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

No branches or pull requests

4 participants