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

import: check that matched key is not a substring of the replacement key #5685

Merged
merged 1 commit into from
Aug 4, 2023

Conversation

WeidiDeng
Copy link
Member

Fix issue reported on community.

When importing arguments, regex will usually match a substring of the key, this change detects if it's a substring match.

Personally I think caddy shouldn't allow braces in the replacer as it has other implications. But this will do for now.

Copy link
Member

@francislavoie francislavoie left a comment

Choose a reason for hiding this comment

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

Thanks! Glad you could find this ☺️

@francislavoie francislavoie added the bug 🐞 Something isn't working label Aug 4, 2023
@francislavoie francislavoie added this to the v2.7.3 milestone Aug 4, 2023
Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

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

Thanks Weidi.

Personally I think caddy shouldn't allow braces in the replacer as it has other implications.

You mean { } braces?

@mholt mholt merged commit 9f34383 into master Aug 4, 2023
19 checks passed
@mholt mholt deleted the fix-args-replacer branch August 4, 2023 16:44
@WeidiDeng
Copy link
Member Author

I mean disallow keys like test{test, the underlying problem is replacer feed the charactes between the opening brace and the first closing brace, and there can be opening braces in between.

Normally this isn't a problem, but in JSON, it is. And if replacer is configured to return an error upon an unknown key, it will.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants