fix: allow square brackets in zip path validation for Next.js dynamic routes (#4468)

* fix: allow square brackets in zip drop path validation for Next.js dynamic routes

ZIP uploads containing Next.js dynamic route files (e.g. app/api/[id]/route.ts,
pages/[slug].tsx) were rejected by readValidDirectory because the path regex
did not include square bracket characters.

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Mauricio Siu
2026-05-22 16:26:34 -06:00
committed by GitHub
parent 6e342ee2f2
commit af8072d7ad
2 changed files with 17 additions and 1 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ export const readValidDirectory = (
directory: string,
serverId?: string | null,
) => {
if (!/^[\w/. :-]{1,500}$/.test(directory)) {
if (!/^[\w/. :[\]-]{1,500}$/.test(directory)) {
return false;
}