Skip to content

CODEOWNERS patterns crashes on paths containing square brackets [param] #42

Description

@azhukov-gyg

Problem
CODEOWNERS patterns fail to match file paths containing square brackets, which are commonly used in modern web frameworks (Next.js, Nuxt.js) for dynamic routes.

Minimal Reproduction

Example 1: File with square brackets

project/
├── pages/
│   ├── index.js
│   └── users/
│       └── [userId].js
└── CODEOWNERS

CODEOWNERS file:

/pages/users/[userId].js @team

Expected Behavior:

The file /pages/users/[userId].js should be owned by @team

Error Produced:

$ codeowners
line 1: unexpected character '[' at position 13

Example 2: Directory with square brackets:

project/
├── pages/
│   ├── index.js
│   └── [userId]/
│       ├── index.js
│       └── details.js
└── CODEOWNERS

CODEOWNERS file:

pages/[userId]/index.js @team1
pages/[userId]/details.js @team2

Expected Behavior:
The file pages/[userId]/index.js should be owned by @team1
The file pages/[userId]/details.js should be owned by @team2

Error Produced:

$ codeowners
line 1: unexpected character '[' at position 7

Activity

  1. hmarr commented on Jul 18, 2026

    @hmarr
    Owner

    Fixed by #44, which is now on main.

  2. otakuu commented on Jul 18, 2026

    @otakuu

    Awesome, when you release it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions