diff --git a/app/mf/microformats.go b/app/mf/microformats.go
index 542eba4..99f405d 100644
--- a/app/mf/microformats.go
+++ b/app/mf/microformats.go
@@ -222,6 +222,9 @@ func DetermineAuthorName(hEntry *microformats.Microformat) string {
if authorName == "" {
authorName = Str(hEntry, "author")
}
+ if authorName == "" {
+ authorName = Str(hEntry, "name")
+ }
return authorName
}
diff --git a/app/webmention/recv/receive_test.go b/app/webmention/recv/receive_test.go
index 157e33c..eada4b8 100644
--- a/app/webmention/recv/receive_test.go
+++ b/app/webmention/recv/receive_test.go
@@ -9,8 +9,10 @@ import (
"github.com/stretchr/testify/assert"
"io/ioutil"
"net/http"
+ "strings"
"testing"
"time"
+ "willnorris.com/go/microformats"
"brainbaking.com/go-jamming/common"
"brainbaking.com/go-jamming/mocks"
@@ -311,6 +313,30 @@ func TestReceiveTargetThatDoesNotPointToTheSourceDoesNothing(t *testing.T) {
assert.Empty(t, repo.GetAllToModerate("brainbaking.com").Data)
}
+func TestConvertBodyToIndiewebDataWithComplicatedDataStillFindsName(t *testing.T) {
+ wm := mf.Mention{
+ Source: "https://pauho.net/2022/05/04/662325/",
+ Target: "https://brainbaking.com/post/2022/04/cool-things-people-do-with-their-blogs/",
+ }
+ cnf := &common.Config{
+ AllowedWebmentionSources: []string{
+ "brainbaking.com",
+ },
+ }
+
+ recv := &Receiver{
+ Conf: cnf,
+ }
+ src, err := ioutil.ReadFile("../../../mocks/indieweb-complicated-data.html")
+ assert.NoError(t, err)
+
+ body := string(src)
+ data := microformats.Parse(strings.NewReader(body), wm.SourceUrl())
+ indieweb := recv.convertBodyToIndiewebData(body, wm, data)
+
+ assert.Equal(t, "Paul Houlihan", indieweb.Author.Name)
+}
+
func TestProcessSourceBodyAnonymizesBothAuthorPictureAndNameIfComingFromSilo(t *testing.T) {
wm := mf.Mention{
Source: "https://brid.gy/post/twitter/ChrisAldrich/1387130900962443264",
diff --git a/mocks/indieweb-complicated-data.html b/mocks/indieweb-complicated-data.html
new file mode 100644
index 0000000..4cd1fcb
--- /dev/null
+++ b/mocks/indieweb-complicated-data.html
@@ -0,0 +1,592 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [Bookmark] Cool Things People Do With Their Blogs – Paul Houlihan
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Skip to content
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Small and independent blogs are always full of surprises. The more blogs I stumble upon, the more genuinely surprised I am by the things people do with their blogs. It seemed like a good idea to summarize highlights here. I hope it might inspire non-bloggers to blog and bloggers to tinker more with …
+
+
+
+
Related
+
+
+
+
+
Published by
+
+
+
+
+
Paul Houlihan
+
+
+ A Scottish man in Brussels ๐ด๓ ง๓ ข๓ ณ๓ ฃ๓ ด๓ ฟ๐ง๐ช. I enยญjoy ๐๏ธ reading, ๐ฎ๏ธ video games, ๐ท๏ธ photography, and โ๏ธ coffee.
+ View all posts by Paul Houlihan
+
+
+
+
+
+
+
+
+
+
+
+
+ Post navigation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+