~netlandish/links-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH links] Add length checker for tag imports.

Details
Message ID
<20250225130556.14842-1-peter@netlandish.com>
Sender timestamp
1740467100
DKIM signature
missing
Download raw message
Patch: +13 -2
Changelog-added: additional import sanity checking to avoid db layer
  errors (ie, max length exceeded).
---
Follow up to a previous commit (513b4084ea) to avoid possible import
errors when tags violate max length

 core/import.go | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/core/import.go b/core/import.go
index 7e6aebb..59e2437 100644
--- a/core/import.go
+++ b/core/import.go
@@ -107,7 +107,18 @@ func (p pinBoardObj) IsUnread() bool {
}

func (p pinBoardObj) GetTags() []string {
	return strings.Split(strings.TrimSpace(p.Tags), " ")
	return trimTags(strings.Split(strings.TrimSpace(p.Tags), " "))
}

func trimTags(tags []string) []string {
	var ret []string
	for _, t := range tags {
		if len(t) > 50 {
			t = t[:50]
		}
		ret = append(ret, t)
	}
	return ret
}

// Especific html object representation, used by Safari and Chrome
@@ -161,7 +172,7 @@ func (h htmlObj) IsUnread() bool {
}

func (h htmlObj) GetTags() []string {
	return strings.Split(strings.TrimSpace(h.Tags), ",")
	return trimTags(strings.Split(strings.TrimSpace(h.Tags), ","))
}

// This adapter struct is used to wrap a slice [n:m]
-- 
2.47.2
Details
Message ID
<D81KB7M14LME.32U7ZIF4WBXLE@netlandish.com>
In-Reply-To
<20250225130556.14842-1-peter@netlandish.com> (view parent)
Sender timestamp
1740468678
DKIM signature
missing
Download raw message
Applied.

To git@git.code.netlandish.com:~netlandish/links
   513b408..5c1230c  master -> master
Reply to thread Export thread (mbox)