Skip to content

Commit

Permalink
improved validation on template creation
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardoferretti committed Feb 24, 2021
1 parent 9ea68e1 commit 69a5d82
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/foam-vscode/src/features/create-from-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ async function createNewTemplate(): Promise<void> {
defaultTemplate.fsPath.length - 3,
],
validateInput: value =>
value.length ? undefined : 'Please enter a value!',
value.trim().length === 0
? 'Please enter a value'
: existsSync(value)
? 'File already exists'
: undefined,
});
if (filename === undefined) {
return;
Expand Down

0 comments on commit 69a5d82

Please sign in to comment.