This commit is contained in:
@@ -89,7 +89,7 @@ func save(store map[string]credential) error {
|
||||
Store: store,
|
||||
}
|
||||
|
||||
f, err := os.OpenFile(filepath.Join(datastorePath, "credential.json"), os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0600)
|
||||
f, err := os.OpenFile(filepath.Clean(filepath.Join(datastorePath, "credential.json")), os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0600)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to open datastore: %w", err)
|
||||
}
|
||||
@@ -104,7 +104,7 @@ func save(store map[string]credential) error {
|
||||
}
|
||||
|
||||
func load() (map[string]credential, error) {
|
||||
f, err := os.OpenFile(filepath.Join(datastorePath, "credential.json"), os.O_RDONLY, 0)
|
||||
f, err := os.OpenFile(filepath.Clean(filepath.Join(datastorePath, "credential.json")), os.O_RDONLY, 0)
|
||||
if err != nil {
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
return make(map[string]credential), nil
|
||||
|
||||
Reference in New Issue
Block a user