Slug length can be MaxLength+1
Redlinkk opened this issue · comments
Romain Poirot commented
When using the truncate function, the slug can be longer than MaxLength
on specific conditions. See this example:
- original string (of length 11): "abcde-fghij"
- MaxLength: 10
- expected string: "abcde"
- output string: "abcde-fghij"
Current function fails on this edge case because the last word doesn't end with a "-" during the max length test here so the - 1
is wrongfully applied.
Dobrosław Żybort commented
@Redlinkk Thank you for catching this, I added more tests, fixed one more problem and merged it. Now it's part of v1.13.0 release.
Aymen Ben Tanfous commented
I actually found another case I described here #76