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

httpcaddyfile: Fix expression matcher shortcut in snippets #6288

Merged
merged 1 commit into from May 1, 2024

Conversation

francislavoie
Copy link
Member

Fixes #6287

Comment on lines +1285 to +1288
}

// convenient way to specify a single path match
if strings.HasPrefix(tkn.Text, "/") {
Copy link
Member Author

Choose a reason for hiding this comment

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

I just don't like else if when all branches return. It can be simplified to simple if and the comment can be hoisted up above the if.

@@ -356,6 +358,19 @@ func (t Token) NumLineBreaks() int {
return lineBreaks
}

// Clone returns a deep copy of the token.
func (t Token) Clone() Token {
Copy link
Member Author

Choose a reason for hiding this comment

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

I needed to make a Clone() because the token has some unexported fields that can't be copied from inside the httpcaddyfile package.

@francislavoie francislavoie merged commit feeb6af into master May 1, 2024
23 checks passed
@francislavoie francislavoie deleted the fix-cel-in-snippet branch May 1, 2024 11:43
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.

(2.8.0-beta.1) CEL expressions in Caddyfile not processed properly
2 participants