Name dinners from links with letter-only words (PR #97 review F2)
CI / ci (push) Successful in 2m25s
CI / ci (pull_request) Successful in 2m24s

Keep only words of at most 20 letters from the link's last path segment,
so punctuated or long token text such as /stew-t=abcdef never reaches
the dinner name, and stop at combined credential words like accesstoken.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-06 20:48:03 -04:00
co-authored by Claude Opus 5.5
parent 903a332375
commit 4e0c31b7d6
2 changed files with 22 additions and 7 deletions
+4
View File
@@ -26,6 +26,10 @@ func TestNameFromURL(t *testing.T) {
{"https://example.com/stew-x7k2p9q4", "Stew"},
{"https://example.com/recipes/token-abcdefghijk", ""},
{"https://example.com/key-lime-pie", "Key lime pie"},
{"https://example.com/stew-t=abcdef", "Stew"},
{"https://example.com/stew-accesstoken-abcdefghijk", "Stew"},
{"https://example.com/stew-abcdefghijklmnopqrstuvwxyz", "Stew"},
{"https://example.com/cre%CC%80me-bru%CC%82le%CC%81e", "Cre\u0300me bru\u0302le\u0301e"},
}
for _, tt := range tests {
u, err := url.Parse(tt.link)