Skip to content

Commit

Permalink
Fixes small issue with todo title being empty when text starts with n…
Browse files Browse the repository at this point in the history
…ew line.
  • Loading branch information
vega113 committed Nov 20, 2023
1 parent de87f8a commit a647d80
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/service/TitleService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trait TitleService {
class TitleServiceImpl extends TitleService {
def makeTitle(text: String): String = {
val maxLength = 50
val firstSegment = text.split("[.,:;\\-\n]")(0)
val firstSegment = text.split("[.,:;\\-\n]").find(_.nonEmpty).getOrElse("")
val firstLine = firstSegment.replaceAll("\\[\\[|]]|#", "")
if (firstLine.length > maxLength) {
firstLine.substring(0, maxLength) + "..."
Expand Down

0 comments on commit a647d80

Please sign in to comment.