caddy icon indicating copy to clipboard operation
caddy copied to clipboard

fileserver: fix try_policy when instantiating file matcher from CEL

Open effleurager opened this issue 1 year ago • 1 comments

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.

effleurager avatar Oct 13 '24 14:10 effleurager

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 avatar Oct 13 '24 15:10 francislavoie

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 avatar Oct 20 '24 14:10 francislavoie

Thanks both!

mholt avatar Oct 21 '24 14:10 mholt