Skip to content

πŸŽ₯ Make videos programmatically with React

`create-video`: Strip control characters from directory name input

Boseok Kangcd14f656141e
diff --git a/packages/create-video/src/resolve-project-root.ts b/packages/create-video/src/resolve-project-root.ts
index b2da552c65..7e6e6368b4 100644
--- a/packages/create-video/src/resolve-project-root.ts
+++ b/packages/create-video/src/resolve-project-root.ts
@@ -98,7 +98,10 @@ export const resolveProjectRoot = async (options?: {
});
if (typeof answer === 'string') {
- projectName = answer.trim();
+ // Strip control characters (U+0000–U+001F, U+007F) that terminal
+ // emulators may inject via readline shortcuts (e.g. Ctrl+U β†’ U+0015)
+ // eslint-disable-next-line no-control-regex
+ projectName = answer.replace(/[\x00-\x1f\x7f]/g, '').trim();
}
}
} catch (error) {