Browse Source

Fix: Don't return mentions when no address provided

master
Jan-Lukas Else 2 weeks ago
parent
commit
affa7d7d54
  1. 3
      webmention.go
  2. 3
      webmention_test.go

3
webmention.go

@ -287,6 +287,9 @@ func (db *database) getWebmentions(config *webmentionsRequestConfig) ([]*mention
}
func (db *database) getWebmentionsByAddress(address string) []*mention {
if address == "" {
return nil
}
mentions, _ := db.getWebmentions(&webmentionsRequestConfig{
target: address,
status: webmentionStatusApproved,

3
webmention_test.go

@ -58,6 +58,9 @@ func Test_webmentions(t *testing.T) {
mentions = app.db.getWebmentionsByAddress("https://example.com/täst")
assert.Len(t, mentions, 0)
mentions = app.db.getWebmentionsByAddress("")
assert.Len(t, mentions, 0)
mentions, err = app.db.getWebmentions(&webmentionsRequestConfig{
sourcelike: "example.net",
})

Loading…
Cancel
Save