From 53507ac2a32a785b5467b1e58d033780d8e02693 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Sun, 29 Aug 2021 12:03:08 +0200 Subject: Mention fixup (#167) * rework mention creation a bit * rework mention creation a bit * tidy up status dereferencing * start adding tests for dereferencing * fixups * fix * review changes --- internal/ap/extract.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'internal/ap/extract.go') diff --git a/internal/ap/extract.go b/internal/ap/extract.go index 1ee0e008e..f8453c9c0 100644 --- a/internal/ap/extract.go +++ b/internal/ap/extract.go @@ -242,8 +242,9 @@ func ExtractImageURL(i WithImage) (*url.URL, error) { // ExtractSummary extracts the summary/content warning of an interface. func ExtractSummary(i WithSummary) (string, error) { summaryProp := i.GetActivityStreamsSummary() - if summaryProp == nil { - return "", errors.New("summary property was nil") + if summaryProp == nil || summaryProp.Len() == 0 { + // no summary to speak of + return "", nil } for iter := summaryProp.Begin(); iter != summaryProp.End(); iter = iter.Next() { @@ -544,12 +545,12 @@ func ExtractMentions(i WithTag) ([]*gtsmodel.Mention, error) { mentionable, ok := t.(Mentionable) if !ok { - continue + return nil, errors.New("mention was not convertable to ap.Mentionable") } mention, err := ExtractMention(mentionable) if err != nil { - continue + return nil, err } mentions = append(mentions, mention) -- cgit v1.2.3