Subject: [PATCH links] Fix import error when bookmark title is more than 150 characters

From: Peter Sanchez <[email-masked]>
Date: Fri, 21 Feb 2025 17:33:17 -0600

---
One of the few places where we don't use the API for writing and it was
missing a max length check. This is the biggest issue when not using the
single point for storing data, you end up missing checks that already 
exist else where.

 core/import.go | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/core/import.go b/core/import.go
index c908823..7e6aebb 100644
--- a/core/import.go
+++ b/core/import.go
@@ -283,8 +283,12 @@ func processOrgLinks(obj importObj, baseURLMap map[string]int,
 		}
 	}
 
+	title := obj.GetTitle()
+	if len(title) > 150 {
+		title = title[:146] + "..."
+	}
 	return &models.OrgLink{
-		Title:       obj.GetTitle(),
+		Title:       title,
 		URL:         obj.GetURL(),
 		Description: obj.GetDescription(),
 		BaseURLID:   sql.NullInt64{Valid: true, Int64: int64(baseID)},
-- 
2.47.2