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

Fix non-existent snippet tags being broken up by an @ tag #16322

Draft
wants to merge 1 commit into
base: 3.x
Choose a base branch
from

Conversation

Mark-H
Copy link
Collaborator

@Mark-H Mark-H commented Dec 3, 2022

What does it do?

Described in #16318, if a non-existent snippet tag is found within an output filter, an @ tag inside the filter can cause the output to break.

The provided example where xxx doesn't exist:

[[+xyz:empty=`
aaa
[[xxx? &x=`bbb@ccc`]]
ddd
`]]
eee

is getting broken up by modTag/modElement::getPropertySet on the @, treating the part in front of it as the name of the tag/element, including half the snippet tag.

This fix makes sure that it only considers the bit up to the first :.

To ensure property sets continue to work, I wanted to add some property set tests but I can't get this structure:

[[!Snippet@PropSet:default=`foo`]]

to return anything when the snippet returns an empty value. If someone can figure out why that's not working (in either the test or real world cases!) that would be great.

Why is it needed?

Make parser more resilient.

How to test

Unit tests or create your own similar test cases with snippets on a resource.

Related issue(s)/PR(s)

Fixes #16318

@cla-bot cla-bot bot added the cla-signed CLA confirmed for contributors to this PR. label Dec 3, 2022
],
[
'This is a [[snippetName@propSetName:default=`default value`]]',
'This is a default value',
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the test that's failing. The snippet returns the value of the prop property, which doesn't exist in this scenario, so the snippet returns an empty value. That should make it return the default filter, but instead it returns nothing at all (This is a ).

Can reproduce the same behavior when creating things manually on a template/resource, so that suggests something is broken?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There is a chance this may've been related to #16337, so will need to test again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed CLA confirmed for contributors to this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

At sign (@) inside chunk parameter value nested into tag output filter breaks tag parsing
1 participant