Name dinners from links with letter-only words (PR #97 review F2)
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user