fix(scripts): dedup URLs stored in markdown autolink form

The duplicate-check boundary set had '<' but not '>', so a URL stored
as <https://…> (autolink, used by older posts) was never detected as a
duplicate. Inherited from the JS engine; found while validating the Go
port against 2020-era posts.
This commit is contained in:
tiennm99 committed 2026-08-18 21:43:57 +07:00
1 parent e8451d8c24
commit c35a14f9bb
2 files changed
+18 -2

No files matched your search

+3 -2
View File
@@ -196,7 +196,8 @@ func uuidBoundaryOK(text string, end int) bool {
// urlBoundaryOK: an optional trailing slash (bareURL strips it, stored URLs may
// keep it), then a path/punctuation delimiter, whitespace, or end of text — so
// /p/foo does not match a stored /p/foo-bar.
// /p/foo does not match a stored /p/foo-bar. The '>' delimiter covers URLs
// stored in markdown autolink form <https://…>, which older posts use.
func urlBoundaryOK(text string, end int) bool {
if end < len(text) && text[end] == '/' {
end++
@@ -208,7 +209,7 @@ func urlBoundaryOK(text string, end int) bool {
case ' ', '\t', '\n', '\r', '\f', '\v':
return true
default:
return strings.IndexByte(`)]"'?#<_&,`, c) != -1
return strings.IndexByte(`)]"'?#<>_&,`, c) != -1
}
}