add validation for non-printable chars in CLI (#6682)
This commit is contained in:
parent
a9c22994e4
commit
3356023443
2 changed files with 8 additions and 0 deletions
5
.changeset/four-ads-clap.md
Normal file
5
.changeset/four-ads-clap.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'create-astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
add validation for non-printable characters
|
|
@ -24,6 +24,9 @@ export async function projectName(ctx: Pick<Context, 'cwd' | 'prompt' | 'project
|
||||||
if (!isEmpty(value)) {
|
if (!isEmpty(value)) {
|
||||||
return `Directory is not empty!`;
|
return `Directory is not empty!`;
|
||||||
}
|
}
|
||||||
|
// Check for non-printable characters
|
||||||
|
if (value.match(/[^\x20-\x7E]/g) !== null)
|
||||||
|
return `Invalid non-printable character present!`;
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue