gosimple / slug

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

fix edge case in truncate function allowing too long slugs #73

Closed Redlinkk closed 2 years ago

Redlinkk commented 2 years ago

Fixes https://github.com/gosimple/slug/issues/72

I'm not using operations on strings to avoid unnecessary allocations. I've added a test case for the fixed issue.

codecov[bot] commented 2 years ago

Codecov Report

Merging #73 (3649d7c) into master (f347b0c) will not change coverage. The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master       #73   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines          135       130    -5     
=========================================
- Hits           135       130    -5     
Impacted Files Coverage Δ
languages_substitution.go 100.00% <100.00%> (ø)
slug.go 100.00% <100.00%> (ø)