diff options
author | FChannel <> | 2022-05-08 14:57:40 -0700 |
---|---|---|
committer | FChannel <> | 2022-06-19 12:53:29 -0700 |
commit | 580dec5b89215310ce34341e11ff17fe38bdb63a (patch) | |
tree | 894424df66a9d9f7e41805822f29adac8fb490fe /activitypub/util.go | |
parent | f7bf818d29393ceaccf4d2906557351fa6a4f49f (diff) |
more cleanup, logging and error logging everywhere
things are mostly in place can work on "features" and polish
Diffstat (limited to 'activitypub/util.go')
-rw-r--r-- | activitypub/util.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activitypub/util.go b/activitypub/util.go index 7aee666..9dfa1ae 100644 --- a/activitypub/util.go +++ b/activitypub/util.go @@ -19,6 +19,18 @@ import ( // False positive for application/ld+ld, application/activity+ld, application/json+json var activityRegexp = regexp.MustCompile("application\\/(ld|json|activity)((\\+(ld|json))|$)") +func AcceptActivity(header string) bool { + accept := false + if strings.Contains(header, ";") { + split := strings.Split(header, ";") + accept = accept || activityRegexp.MatchString(split[0]) + accept = accept || strings.Contains(split[len(split)-1], "profile=\"https://www.w3.org/ns/activitystreams\"") + } else { + accept = accept || activityRegexp.MatchString(header) + } + return accept +} + func CreateAttachmentObject(file multipart.File, header *multipart.FileHeader) ([]ObjectBase, *os.File, error) { contentType, err := util.GetFileContentType(file) if err != nil { |