summaryrefslogtreecommitdiff
path: root/internal/ap/extract.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2024-08-13 09:01:50 +0000
committerLibravatar GitHub <noreply@github.com>2024-08-13 09:01:50 +0000
commit5212a1057ed05085d4d332976510880c6a692a8e (patch)
tree33ec543f66439328983deb688d3c10ae37e91264 /internal/ap/extract.go
parent[bugfix] incorrect AP serialize function used serializing worker data (#3196) (diff)
downloadgotosocial-5212a1057ed05085d4d332976510880c6a692a8e.tar.xz
[bugfix] relax missing preferred_username, instead using webfingered username (#3189)
* support no preferred_username, instead using webfingered username * add tests for the new preferred_username behaviour
Diffstat (limited to 'internal/ap/extract.go')
-rw-r--r--internal/ap/extract.go11
1 files changed, 3 insertions, 8 deletions
diff --git a/internal/ap/extract.go b/internal/ap/extract.go
index ce1e2d421..f69fb299e 100644
--- a/internal/ap/extract.go
+++ b/internal/ap/extract.go
@@ -195,17 +195,12 @@ func ExtractPollOptionables(arr []TypeOrIRI) ([]PollOptionable, []TypeOrIRI) {
// ExtractPreferredUsername returns a string representation of
// an interface's preferredUsername property. Will return an
// error if preferredUsername is nil, not a string, or empty.
-func ExtractPreferredUsername(i WithPreferredUsername) (string, error) {
+func ExtractPreferredUsername(i WithPreferredUsername) string {
u := i.GetActivityStreamsPreferredUsername()
if u == nil || !u.IsXMLSchemaString() {
- return "", gtserror.New("preferredUsername nil or not a string")
- }
-
- if u.GetXMLSchemaString() == "" {
- return "", gtserror.New("preferredUsername was empty")
+ return ""
}
-
- return u.GetXMLSchemaString(), nil
+ return u.GetXMLSchemaString()
}
// ExtractName returns the first string representation it