Skip to content

Add leniency to missing array values in mustache #126550

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

Merged
merged 2 commits into from
Apr 9, 2025
Merged

Conversation

jdconrad
Copy link
Contributor

@jdconrad jdconrad commented Apr 9, 2025

In mustache, this change returns null values which convert to empty strings instead of throwing an exception when users have a template with something like a.8 where the index 8 is out of bounds. This matches the behavior for non-existent keys like a.d.

Closes #55200

@jdconrad jdconrad added >bug :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache v9.1.0 labels Apr 9, 2025
@jdconrad jdconrad requested a review from a team as a code owner April 9, 2025 18:12
@elasticsearchmachine elasticsearchmachine added the Team:Core/Infra Meta label for core/infra team label Apr 9, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@elasticsearchmachine
Copy link
Collaborator

Hi @jdconrad, I've created a changelog YAML for you.

Copy link
Contributor

@prdoyle prdoyle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jdconrad jdconrad merged commit 3d54cc3 into elastic:main Apr 9, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache Team:Core/Infra Meta label for core/infra team v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mustache template evaluation failure for non-existent array indices
3 participants