mirror of
https://gitlab.melroy.org/melroy/fediresolve.git
synced 2025-07-23 21:18:52 +00:00
Show URL with the attachment of type link
This commit is contained in:
parent
bdb8dbbdc4
commit
4a2a9c7cdf
1 changed files with 6 additions and 1 deletions
|
@ -131,6 +131,7 @@ func formatContent(jsonStr string, parts []string, bold, green, yellow func(a ..
|
||||||
attachmentType := attachment.Get("type").String()
|
attachmentType := attachment.Get("type").String()
|
||||||
mediaType := attachment.Get("mediaType").String()
|
mediaType := attachment.Get("mediaType").String()
|
||||||
url := attachment.Get("url").String()
|
url := attachment.Get("url").String()
|
||||||
|
href := attachment.Get("href").String()
|
||||||
name := attachment.Get("name").String()
|
name := attachment.Get("name").String()
|
||||||
|
|
||||||
// Truncate long descriptions
|
// Truncate long descriptions
|
||||||
|
@ -147,7 +148,11 @@ func formatContent(jsonStr string, parts []string, bold, green, yellow func(a ..
|
||||||
}
|
}
|
||||||
parts = append(parts, attachmentInfo)
|
parts = append(parts, attachmentInfo)
|
||||||
|
|
||||||
if url != "" {
|
// For type Page and attachment type Link, show href if present
|
||||||
|
objectType := gjson.Get(jsonStr, "type").String()
|
||||||
|
if objectType == "Page" && attachmentType == "Link" && href != "" {
|
||||||
|
parts = append(parts, fmt.Sprintf(" URL: %s", green(href)))
|
||||||
|
} else if url != "" {
|
||||||
parts = append(parts, fmt.Sprintf(" URL: %s", green(url)))
|
parts = append(parts, fmt.Sprintf(" URL: %s", green(url)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue