Skip to content

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
@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