mirror of
https://github.com/mickael-menu/zk
synced 2024-11-13 01:10:43 +00:00
Fix crash when creating a new note fails (#83)
This commit is contained in:
parent
dc27a7dd7c
commit
977dc20bcb
@ -42,15 +42,17 @@ func (cmd *New) Run(container *cli.Container) error {
|
||||
Extra: cmd.Extra,
|
||||
Date: time.Now(),
|
||||
})
|
||||
path := filepath.Join(notebook.Path, note.Path)
|
||||
if err != nil {
|
||||
var path string
|
||||
if err == nil {
|
||||
path = filepath.Join(notebook.Path, note.Path)
|
||||
} else {
|
||||
var noteExists core.ErrNoteExists
|
||||
if !errors.As(err, ¬eExists) {
|
||||
return err
|
||||
}
|
||||
|
||||
if confirmed, _ := container.Terminal.Confirm(
|
||||
fmt.Sprintf("%s already exists, do you want to edit this note instead?", note.Path),
|
||||
fmt.Sprintf("%s already exists, do you want to edit this note instead?", noteExists.Name),
|
||||
true,
|
||||
); !confirmed {
|
||||
// abort...
|
||||
|
Loading…
Reference in New Issue
Block a user