[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

@@ -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()
}
}