fix faulty outbox database check logic when it doesn't exist.

fixes https://github.com/fiatjaf/nak/issues/66
This commit is contained in:
fiatjaf 2025-05-21 14:12:07 -03:00
parent f450e735b6
commit 61a68f3dca
2 changed files with 3 additions and 3 deletions

View File

@ -85,7 +85,7 @@ var app = &cli.Command{
sys = sdk.NewSystem() sys = sdk.NewSystem()
if err := initializeOutboxHintsDB(c, sys); err != nil { if err := initializeOutboxHintsDB(c, sys); err != nil {
return ctx, fmt.Errorf("failed to initialized outbox hints: %w", err) return ctx, fmt.Errorf("failed to initialize outbox hints: %w", err)
} }
sys.Pool = nostr.NewPool(nostr.PoolOptions{ sys.Pool = nostr.NewPool(nostr.PoolOptions{

View File

@ -29,9 +29,9 @@ func initializeOutboxHintsDB(c *cli.Command, sys *sdk.System) error {
hintsFilePath = filepath.Join(configPath, "outbox/hints.bg") hintsFilePath = filepath.Join(configPath, "outbox/hints.bg")
} }
if hintsFilePath != "" { if hintsFilePath != "" {
if _, err := os.Stat(hintsFilePath); !os.IsNotExist(err) { if _, err := os.Stat(hintsFilePath); err == nil {
hintsFileExists = true hintsFileExists = true
} else if err != nil { } else if !os.IsNotExist(err) {
return err return err
} }
} }