Skip to content

fileserver: append repeated hide subdirectives instead of overwriting#7817

Merged
steadytao merged 2 commits into
caddyserver:masterfrom
luccinmasirika:fix-7815-file-server-hide-append
Jun 13, 2026
Merged

fileserver: append repeated hide subdirectives instead of overwriting#7817
steadytao merged 2 commits into
caddyserver:masterfrom
luccinmasirika:fix-7815-file-server-hide-append

Conversation

@luccinmasirika

Copy link
Copy Markdown
Contributor

Fixes #7815.

Repeated hide subdirectives in a file_server block were silently overwriting each other — only the last entry took effect. So hide cobra* followed by hide main.go would stop hiding cobra* files, which is surprising. This makes them append instead, so multiple hide lines 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 repeated hide entries produce the combined list. Ran the fileserver package tests, the full adapt suite, gofmt and go vet locally — 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.

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

CLAassistant commented Jun 13, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@steadytao steadytao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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 steadytao added bug 🐞 Something isn't working needs docs ✍️ Requires documentation changes labels Jun 13, 2026
@steadytao steadytao removed the needs docs ✍️ Requires documentation changes label Jun 13, 2026

@steadytao steadytao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Docs in caddyserver/website#545. Thank you for the PR @luccinmasirika

@steadytao steadytao merged commit 39c9a85 into caddyserver:master Jun 13, 2026
35 checks passed
@steadytao steadytao added this to the v2.11.5 milestone Jun 13, 2026
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.

Caddyfile: Handle multiple hide sub-directives in file_server

3 participants