[GH-ISSUE #64] Non-parity wildcard/globbing behavior on include #30

Closed
opened 2026-02-28 01:20:35 +03:00 by kerem · 4 comments
Owner

Originally created by @nf-brentsaner on GitHub (Feb 11, 2025).
Original GitHub issue: https://github.com/tufanbarisyildirim/gonginx/issues/64

Originally assigned to: @tufanbarisyildirim on GitHub.

When NGINX encounters an include foo/* directive, it does NOT include hidden files in the globbed match.

However, a *(github.com/tufanbarisyildirim/gonginx/parser.Parser).Parse() with a parser.Optiion of parser.WithIncludeParsing() does include hidden files if that include directive uses wildcards/globs.

This has led to a particularly confusing bug for us, as nginx -t validates but the parsing would fail consistently. :)

If include parsing is enabled, I'd filter the globbed list and filter each item out of it matches an if strings.HasPrefix(filepath.Base(fname), ".") (where fname is the filename/filepath, and filepath is stdlib's path/filepath).

Originally created by @nf-brentsaner on GitHub (Feb 11, 2025). Original GitHub issue: https://github.com/tufanbarisyildirim/gonginx/issues/64 Originally assigned to: @tufanbarisyildirim on GitHub. When NGINX encounters an `include foo/*` directive, it does NOT include hidden files in the globbed match. However, a `*(github.com/tufanbarisyildirim/gonginx/parser.Parser).Parse()` with a parser.Optiion of `parser.WithIncludeParsing()` *does* include hidden files if that `include` directive uses wildcards/globs. This has led to a particularly confusing bug for us, as `nginx -t` validates but the parsing would fail consistently. :) If include parsing is enabled, I'd filter the globbed list and filter each item out of it matches an `if strings.HasPrefix(filepath.Base(fname), ".")` (where `fname` is the filename/filepath, and `filepath` is stdlib's `path/filepath`).
kerem 2026-02-28 01:20:35 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@tufanbarisyildirim commented on GitHub (Mar 16, 2025):

Thanks for reporting this @nf-brentsaner would you like to create a PR to fix?

<!-- gh-comment-id:2727532391 --> @tufanbarisyildirim commented on GitHub (Mar 16, 2025): Thanks for reporting this @nf-brentsaner would you like to create a PR to fix?
Author
Owner

@nf-brentsaner commented on GitHub (Mar 18, 2025):

@tufanbarisyildirim I'll try to fit it in but it may be some time before I can! It obviously shouldn't take too long for me to do once I can devote time on it since I've already identified the how/where/why.

<!-- gh-comment-id:2732100406 --> @nf-brentsaner commented on GitHub (Mar 18, 2025): @tufanbarisyildirim I'll try to fit it in but it may be some time before I can! It obviously shouldn't take too long for me to do once I can devote time on it since I've already identified the how/where/why.
Author
Owner

@nf-brentsaner commented on GitHub (Mar 18, 2025):

As per #67 shown above, PR in!

<!-- gh-comment-id:2733572099 --> @nf-brentsaner commented on GitHub (Mar 18, 2025): As per #67 shown above, PR in!
Author
Owner

@tufanbarisyildirim commented on GitHub (Feb 20, 2026):

Implemented in #76 (include glob wildcard now skips hidden files to match nginx behavior, with regression tests).

<!-- gh-comment-id:3932203757 --> @tufanbarisyildirim commented on GitHub (Feb 20, 2026): Implemented in #76 (include glob wildcard now skips hidden files to match nginx behavior, with regression tests).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/gonginx#30
No description provided.