mirror of https://github.com/jlelse/GoBlog
Fix: Don't return mentions when no address provided
This commit is contained in:
parent
783afc1c3e
commit
affa7d7d54
|
@ -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,
|
||||
|
|
|
@ -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…
Reference in New Issue