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: missing escape special characters #883

Conversation

przemkalit
Copy link
Contributor

What does this PR do?

fix #882

How should this be tested?

explained in a bug

Is there a relevant Issue open for this?

resolves #882

Other Relevant info, PRs, etc

N/A

Copy link
Contributor

@adonisgarciac adonisgarciac left a comment

Choose a reason for hiding this comment

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

I'm testing this change and it is transforming:
XXX report \\10.10.10.128\something$\whatever\yyy\zzz
to

XXX report \\\\\\\\10.10.10.128\\\\something\\$\\\\whatever\\\\yyy\\\\zzz

which ends up applying the following description:

XXX report \\\\10.10.10.128\\something\$\\whatever\\yyy\\zzz

which is not the original one.

After some tests, I think we don't need to escape $ and we should apply something like:

regex_replace('([\\\"])', '\\\\1')

which transform the description to

XXX report \\\\10.10.10.128\\something$\\whatever\\yyy\\zzz

and it will end up applying the origin description:

XXX report \\10.10.10.128\something$\whatever\yyy\zzz

which is the original one.

@przemkalit
Copy link
Contributor Author

Ok, I've changed the regex, thanks for the testing

Copy link
Contributor

@adonisgarciac adonisgarciac left a comment

Choose a reason for hiding this comment

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

Sorry, I've tested again and it seemed to work but only for . For " symbol it didn't work.

I think the right expression would be:

regex_replace('([\"])', '\1')

Can you test it?

@przemkalit
Copy link
Contributor Author

Sorry, I've tested again and it seemed to work but only for . For " symbol it didn't work.

I think the right expression would be:

regex_replace('(["])', '\1')

Can you test it?

Sorry for late response, but this regex doesn't work and issue with loading yaml happens again.

@przemkalit
Copy link
Contributor Author

I've reverted the regex to the proposed by me, due to my previous comment.

@przemkalit
Copy link
Contributor Author

Hi, I've discovered that issue is related only when the files are included by the include_vars module instead of filetree_read, so I will close this PR.

@przemkalit przemkalit closed this Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing escaping special characters in description.
3 participants