diff --git a/webmention.go b/webmention.go index 7cf8de8..3af4d65 100644 --- a/webmention.go +++ b/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, diff --git a/webmention_test.go b/webmention_test.go index fb098dd..9490feb 100644 --- a/webmention_test.go +++ b/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", })