gosimple / slug

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

Fixed truncation issue #77

Closed Aym3nTN closed 2 years ago

Aym3nTN commented 2 years ago

https://github.com/gosimple/slug/issues/76 " When trying to truncate a string with a value greater than its size, we get the below error.

Example of failed test: {"DOBROSLAWZYBORT", 17, "dobroslawzybort", false}

--- FAIL: TestSlugMakeSmartTruncate (0.01s)
panic: runtime error: slice bounds out of range [:17] with length 15 [recovered]
    panic: runtime error: slice bounds out of range [:17] with length 15

"

codecov[bot] commented 2 years ago

Codecov Report

Merging #77 (d046b02) into master (e79300e) will not change coverage. The diff coverage is 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #77 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 2 2 Lines 142 142 ========================================= Hits 142 142 ``` | [Impacted Files](https://codecov.io/gh/gosimple/slug/pull/77?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=gosimple) | Coverage Δ | | |---|---|---| | [slug.go](https://codecov.io/gh/gosimple/slug/pull/77/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=gosimple#diff-c2x1Zy5nbw==) | `100.00% <100.00%> (ø)` | |
matrixik commented 2 years ago

And here I though that I added enough new test cases. Thank you for finding and fixing it.