-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Liquid filters and comparison stopped working after upgrade to 1.9 #15625
Comments
@sebastienros thoughts? |
@SzymonSel Can you try using |
@MikeAlhayek I tried the fluid tests with this option and it worked. Will have to debug that in OC. |
Works for me in main, @SzymonSel we need a more detailed repro |
Got a another one when when trying to devide integer by decimal. Not very forgiving... I create a more detailed description shortly.
|
@sebastienros I am facing the same problem with OC preview "before merging STJ" I added a workflow that would create a content type
Assigning the Text works. But |
3 different issues to me though. The first one I proved it was working, I will need a better repro. The second one is a JSON conversion issue in Fluid. Could use a repro, but maybe I can try to guess how this would happen. Probably a JsonValue number is used as the input. The 3rd one looks like a property/class no registered (allowed) in the templates. |
I have to look more. not sure. The following test works
|
By this one are you referring to the issue I posted here #15625 (comment) ? That data is coming from a form and is in I added this to the Log Task just before creating the content item.
As you can see in the logs I am getting the expected value of So the Liquid |
Okay. I think I found my issue So changing
to
fixes the problem for me. @sebastienros in this the expected results? printing |
InvalidCastException: Unable to cast object of type 'System.Text.Json.Nodes.JsonValuePrimitive`1[System.Text.Json.JsonElement]' to type 'System.IConvertible'.
System.Convert.ToDecimal(object value)
Fluid.Values.ObjectValueBase.ToNumberValue()
Fluid.Filters.NumberFilters.DividedBy(FluidValue input, FilterArguments arguments, TemplateContext context) I need to check in Fluid how these STJ nodes get converted to FluidValue. It's possible that Newtonsoft was implementing IConvertible and not STJ. |
For @MikeAlhayek 's issue we need to check that |
I would need to check with the Liquid language if that's expected. In a way we could assume that comparing a string to a datetime should try to compare the datetime values by parsing the string. |
Correct, it worked until the switch from Oh, I don't get decived by the |
Sure, I'll give it go! Thanks! |
This looks like a different problem than addressed in #15816. In
JsonObject to fluid, so the dynamic wrappers are not used in liquid as far as I see.
|
I will debug that then |
I've created #16053 as a starting point for a solution. But I'm not sure about the date and time values, or how they should be supported in Liquid. |
Describe the bug
Another breaking change is in our Liquid views. What stopped working:
{% assign formated_datetime = Model.ContentItem.CreatedAtUtc | date: "%y-%M-%d" %}
this return and empty stringUNLESS a do some hacking and use the
raw
filter like so:{% assign formated_datetime = Model.ContentItem.CreatedAtUtc | raw | date: "%y-%M-%d" %}
The text was updated successfully, but these errors were encountered: