Skip to content
Snippets Groups Projects
Commit 19f777e8 authored by Travis Ralston's avatar Travis Ralston
Browse files

Don't duplicate the first word in a url preview title

This would only happen for links that are too long.
parent 2dffb310
No related branches found
No related tags found
No related merge requests found
...@@ -44,7 +44,7 @@ func summarize(text string, maxWords int, maxLength int) (string) { ...@@ -44,7 +44,7 @@ func summarize(text string, maxWords int, maxLength int) (string) {
if len(result) > maxLength { if len(result) > maxLength {
// First try trimming off the last word // First try trimming off the last word
words = strings.Split(result, " ") words = strings.Split(result, " ")
newResult := words[0] newResult := ""
for _, word := range words { for _, word := range words {
if len(newResult+" "+word) > maxLength { if len(newResult+" "+word) > maxLength {
break break
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment