Skip to content

Commit

Permalink
sqlite: check for empty destPath
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Sep 11, 2024
1 parent 3b5ee32 commit 4b35441
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions persist/sqlite/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ func (s *Store) Backup(ctx context.Context, destPath string) (err error) {
// prevent overwriting the destination file
if _, err := os.Stat(destPath); !errors.Is(err, os.ErrNotExist) {
return errors.New("destination file already exists")
} else if len(destPath) == 0 {

Check failure on line 180 in persist/sqlite/store.go

View workflow job for this annotation

GitHub Actions / test / test (1.22, ubuntu-latest)

emptyStringTest: replace `len(destPath) == 0` with `destPath == ""` (gocritic)
return errors.New("empty destination path")
}

// create the destination database
Expand Down

0 comments on commit 4b35441

Please sign in to comment.