From 4a2a9c7cdf5405f4d302ee4d61333f2fd5116dc5 Mon Sep 17 00:00:00 2001 From: Melroy van den Berg Date: Thu, 24 Apr 2025 17:21:57 +0200 Subject: [PATCH] Show URL with the attachment of type link --- formatter/formatter.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/formatter/formatter.go b/formatter/formatter.go index 6447c20..71d10c9 100644 --- a/formatter/formatter.go +++ b/formatter/formatter.go @@ -131,6 +131,7 @@ func formatContent(jsonStr string, parts []string, bold, green, yellow func(a .. attachmentType := attachment.Get("type").String() mediaType := attachment.Get("mediaType").String() url := attachment.Get("url").String() + href := attachment.Get("href").String() name := attachment.Get("name").String() // Truncate long descriptions @@ -147,7 +148,11 @@ func formatContent(jsonStr string, parts []string, bold, green, yellow func(a .. } 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))) } }