Skip to content

Commit

Permalink
fix bug when importing a sycned list
Browse files Browse the repository at this point in the history
If you attempt to set up a synced list into a non-home directory that
does not have a .todos.json file, it would overwrite the .todos.json in
the home directory.

The fix was to initialize the FileStore repo, so it creates a
.todos.json locally first.
  • Loading branch information
Grant Ammons committed Oct 22, 2020
1 parent 9406984 commit 65c8a7b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ultralist/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,8 @@ func (a *App) SetupSync() {
return
}
}
// pull a list from ultralist.io

// at this point, it is known that a local todos file does not exist.
type Response struct {
Todolists []TodoList `json:"todolists"`
}
Expand All @@ -373,6 +374,7 @@ func (a *App) SetupSync() {

idx, _, _ := prompt2.Run()
a.TodoList = &response.Todolists[idx]
a.TodoStore.Initialize()
a.TodoStore.Save(a.TodoList.Data)

a.EventLogger = NewEventLogger(a.TodoList, a.TodoStore)
Expand Down

0 comments on commit 65c8a7b

Please sign in to comment.