fileserver: append repeated hide subdirectives instead of overwriting#7817
Merged
steadytao merged 2 commits intoJun 13, 2026
Merged
Conversation
Multiple `hide` subdirectives in a file_server Caddyfile block silently overwrote each other, so only the last one took effect. Append to the list instead, so repeated entries accumulate and imported snippets can compose with site-specific hides. Closes caddyserver#7815 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
steadytao
approved these changes
Jun 13, 2026
steadytao
left a comment
Member
There was a problem hiding this comment.
LGTM. Repeated hide should append because the subdirective already accepts a list and this makes imported snippets compose correctly with site-specific hides.
Docs can be handled separately.
steadytao
approved these changes
Jun 13, 2026
Member
There was a problem hiding this comment.
LGTM. Docs in caddyserver/website#545. Thank you for the PR @luccinmasirika
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7815.
Repeated
hidesubdirectives in afile_serverblock were silently overwriting each other — only the last entry took effect. Sohide cobra*followed byhide main.gowould stop hidingcobra*files, which is surprising. This makes them append instead, so multiplehidelines accumulate and imported snippets compose with site-specific hides, as discussed in the issue.I added an adapt regression test (
file_server_hide_repeated) checking that repeatedhideentries produce the combined list. Ran the fileserver package tests, the full adapt suite,gofmtandgo vetlocally — all green.Assistance Disclosure: I used Claude (an AI assistant) to help locate the code, draft the one-line fix, and write the regression test. I reviewed it, confirmed it matches the behavior agreed in the issue, ran the tests/gofmt/vet myself, and I understand and stand behind the change.