next.js
8688f98b - fix(config): correctly validate cacheHandlers names (#95358)

Commit
27 days ago
fix(config): correctly validate cacheHandlers names (#95358) ## What? The current `cacheHandlers` validation uses `/[a-z-]/`, which only checks whether a key contains at least one lowercase letter or hyphen. As a result, invalid keys such as `abc123`, `abc_123`, `abc.def`, and `handler!` are accepted even though they contain characters outside the documented allowed set. ## Why? The validation error states that handler names must only contain `a-z` and `-`, but the current implementation does not enforce that constraint because the regex is not anchored. ## How? - Replace `/[a-z-]/` with `/^[a-z-]+$/` so the entire handler name is validated. - Add regression tests covering both valid and invalid handler names. ## Testing - Added regression tests in `packages/next/src/server/config.test.ts`. <!-- NEXT_JS_LLM_PR -->
Parents
Loading