Skip to content

fileserver: fix try_policy when instantiating file matcher from CEL#6624

Merged
francislavoie merged 2 commits intocaddyserver:masterfrom
effleurager:file-cel-expression
Oct 20, 2024
Merged

fileserver: fix try_policy when instantiating file matcher from CEL#6624
francislavoie merged 2 commits intocaddyserver:masterfrom
effleurager:file-cel-expression

Conversation

@effleurager
Copy link
Contributor

I found a minor bug in #6623 for the file matcher when written as a CEL expression.

This PR corrects the current reassignment of root, and adds a test to ensure the correct property is set.

@francislavoie
Copy link
Member

Thanks!

I'm not sure that test properly covers it though? Wouldn't it need more than one try_files at least to tell them apart with that policy? I figure it could be tricky tho because git might make those test files have the same mod time though 🤔 not sure how to best test that.

@francislavoie francislavoie added the bug 🐞 Something isn't working label Oct 20, 2024
@francislavoie
Copy link
Member

I reworked the test to use largest_size which we can guarantee when using Git (since file mod time is based on when you checkout the changes etc), and validating that it does indeed pick the correct file by checking the value in the replacer.

@francislavoie francislavoie enabled auto-merge (squash) October 20, 2024 14:02
@francislavoie francislavoie merged commit 9753c44 into caddyserver:master Oct 20, 2024
@mholt
Copy link
Member

mholt commented Oct 21, 2024

Thanks both!

mohammed90 pushed a commit to cedricziel/caddy that referenced this pull request Aug 29, 2025
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