making it a little better, so compiler wont complain.

This commit is contained in:
Kay 2025-01-28 15:44:42 +00:00 committed by fiatjaf_
parent c4d9ef1025
commit 65383d6d65
2 changed files with 4 additions and 4 deletions

View File

@ -43,7 +43,7 @@ func (rl *Relay) AddEvent(ctx context.Context, evt *nostr.Event) (skipBroadcast
case eventstore.ErrDupEvent: case eventstore.ErrDupEvent:
return true, nil return true, nil
default: default:
return false, fmt.Errorf(nostr.NormalizeOKMessage(err.Error(), "error")) return false, fmt.Errorf("%s", nostr.NormalizeOKMessage(err.Error(), "error"))
} }
} }
} }
@ -56,7 +56,7 @@ func (rl *Relay) AddEvent(ctx context.Context, evt *nostr.Event) (skipBroadcast
case eventstore.ErrDupEvent: case eventstore.ErrDupEvent:
return true, nil return true, nil
default: default:
return false, fmt.Errorf(nostr.NormalizeOKMessage(err.Error(), "error")) return false, fmt.Errorf("%s", nostr.NormalizeOKMessage(err.Error(), "error"))
} }
} }
} }
@ -95,7 +95,7 @@ func (rl *Relay) AddEvent(ctx context.Context, evt *nostr.Event) (skipBroadcast
case eventstore.ErrDupEvent: case eventstore.ErrDupEvent:
return true, nil return true, nil
default: default:
return false, fmt.Errorf(nostr.NormalizeOKMessage(saveErr.Error(), "error")) return false, fmt.Errorf("%s", nostr.NormalizeOKMessage(saveErr.Error(), "error"))
} }
} }
} }

View File

@ -131,7 +131,7 @@ func (rl *Relay) getBaseURL(r *http.Request) string {
if proto == "" { if proto == "" {
if host == "localhost" { if host == "localhost" {
proto = "http" proto = "http"
} else if strings.Index(host, ":") != -1 { } else if strings.Contains(host, ":") {
// has a port number // has a port number
proto = "http" proto = "http"
} else if _, err := strconv.Atoi(strings.ReplaceAll(host, ".", "")); err == nil { } else if _, err := strconv.Atoi(strings.ReplaceAll(host, ".", "")); err == nil {