fix: validate workspace name length (max 50 chars) on create and fork (#9854)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-07-01 10:42:15 +02:00
committed by GitHub
parent 293647de4c
commit b52972d0de
3 changed files with 29 additions and 3 deletions
+9
View File
@@ -186,6 +186,15 @@ async function createWorkspaceFork(
// branch creation — a late backend rejection would leave cloned databases
// behind.
validateForkWorkspaceId(trueWorkspaceId);
// The workspace.name column is character varying(50); reject an over-long name
// up front (matching the name actually sent to the backend below) instead of
// failing late after databases are cloned and the git branch is created.
const effectiveName = opts.createWorkspaceName ?? workspaceName ?? trueWorkspaceId;
if (effectiveName.length > 50) {
throw new Error(
`Fork workspace name is too long (${effectiveName.length} chars; max 50). Choose a shorter name.`
);
}
let alreadyExists = false;
try {
alreadyExists = await wmill.existsWorkspace({