From 6b4f6dc7555e4a4a632ee1654596b8ed4d09853e Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Wed, 26 Apr 2023 17:17:22 +0200 Subject: [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 --- internal/ap/extract.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'internal/ap/extract.go') diff --git a/internal/ap/extract.go b/internal/ap/extract.go index c0a6ab5b5..2742d27ac 100644 --- a/internal/ap/extract.go +++ b/internal/ap/extract.go @@ -56,10 +56,13 @@ func ExtractName(i WithName) string { return "" } - // take the first name string we can find + // Take the first useful value for the name string we can find. for iter := nameProp.Begin(); iter != nameProp.End(); iter = iter.Next() { - if iter.IsXMLSchemaString() && iter.GetXMLSchemaString() != "" { + switch { + case iter.IsXMLSchemaString(): return iter.GetXMLSchemaString() + case iter.IsIRI(): + return iter.GetIRI().String() } } @@ -253,10 +256,10 @@ func ExtractSummary(i WithSummary) string { for iter := summaryProp.Begin(); iter != summaryProp.End(); iter = iter.Next() { switch { - case iter.IsIRI(): - return iter.GetIRI().String() case iter.IsXMLSchemaString(): return iter.GetXMLSchemaString() + case iter.IsIRI(): + return iter.GetIRI().String() } } @@ -354,10 +357,10 @@ func ExtractContent(i WithContent) string { } for iter := contentProperty.Begin(); iter != contentProperty.End(); iter = iter.Next() { - if iter.IsXMLSchemaString() { + switch { + case iter.IsXMLSchemaString(): return iter.GetXMLSchemaString() - } - if iter.IsIRI() && iter.GetIRI() != nil { + case iter.IsIRI(): return iter.GetIRI().String() } } -- cgit v1.2.3