diff options
author | 2023-04-26 17:17:22 +0200 | |
---|---|---|
committer | 2023-04-26 16:17:22 +0100 | |
commit | 6b4f6dc7555e4a4a632ee1654596b8ed4d09853e (patch) | |
tree | b168528d0a0003e908b16192882dbe5e4752448a /internal/ap/extract.go | |
parent | [docs] Migrates Chart Location (#1708) (diff) | |
download | gotosocial-6b4f6dc7555e4a4a632ee1654596b8ed4d09853e.tar.xz |
[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
Diffstat (limited to 'internal/ap/extract.go')
-rw-r--r-- | internal/ap/extract.go | 17 |
1 files changed, 10 insertions, 7 deletions
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() } } |