gosimple / slug

URL-friendly slugify with multiple languages support.
Mozilla Public License 2.0
1.15k stars 108 forks source link

Slug length can be MaxLength+1 #72

Closed Redlinkk closed 2 years ago

Redlinkk commented 2 years ago

When using the truncate function, the slug can be longer than MaxLength on specific conditions. See this example:

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.

matrixik commented 2 years ago

@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.

Aym3nTN commented 2 years ago

I actually found another case I described here https://github.com/gosimple/slug/issues/76