Validate book name (#185)

This commit is contained in:
Sung Won Cho 2019-05-18 17:03:06 +10:00 committed by GitHub
commit 813040ea21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -98,6 +98,10 @@ func newRun(ctx infra.DnoteCtx) core.RunEFunc {
return func(cmd *cobra.Command, args []string) error {
bookName := args[0]
if err := validateBookName(bookName); err != nil {
return errors.Wrap(err, "invalid book name")
}
if content == "" {
fpath := core.GetDnoteTmpContentPath(ctx)
err := core.GetEditorInput(ctx, fpath, &content)