[bugfix] Fix remaining mangled URI escaping issues in statuses + accounts (#1712)

* start fiddling with normalize + extract functions

* normalize attachment name (image description)

* NormalizeAccountableSummary

* normalize summary + name
This commit is contained in:
tobi
2023-04-26 17:17:22 +02:00
committed by GitHub
parent ae9d432f13
commit 6b4f6dc755
6 changed files with 498 additions and 49 deletions

View File

@ -27,8 +27,7 @@ import (
)
// ResolveStatusable tries to resolve the given bytes into an ActivityPub Statusable representation.
// It will then perform normalization on the Statusable by calling NormalizeStatusable, so that
// callers don't need to bother doing extra steps.
// It will then perform normalization on the Statusable.
//
// Works for: Article, Document, Image, Video, Note, Page, Event, Place, Profile
func ResolveStatusable(ctx context.Context, b []byte) (Statusable, error) {
@ -73,11 +72,16 @@ func ResolveStatusable(ctx context.Context, b []byte) (Statusable, error) {
return nil, newErrWrongType(err)
}
NormalizeStatusableContent(statusable, rawStatusable)
NormalizeContent(statusable, rawStatusable)
NormalizeAttachments(statusable, rawStatusable)
NormalizeSummary(statusable, rawStatusable)
NormalizeName(statusable, rawStatusable)
return statusable, nil
}
// ResolveStatusable tries to resolve the given bytes into an ActivityPub Accountable representation.
// It will then perform normalization on the Accountable.
//
// Works for: Application, Group, Organization, Person, Service
func ResolveAccountable(ctx context.Context, b []byte) (Accountable, error) {
@ -114,5 +118,7 @@ func ResolveAccountable(ctx context.Context, b []byte) (Accountable, error) {
return nil, newErrWrongType(err)
}
NormalizeSummary(accountable, rawAccountable)
return accountable, nil
}