Skip to content

fix: hard-truncate when smart_truncate separator is empty - #186

Closed
santhreal wants to merge 1 commit into
un33k:masterfrom
santhreal:fix/smart-truncate-empty-sep-v2
Closed

santhreal wants to merge 1 commit into
un33k:masterfrom
santhreal:fix/smart-truncate-empty-sep-v2

Conversation

@santhreal

Copy link
Copy Markdown

smart_truncate hits ValueError when word_boundary=True separator=''. This PR fixes the regression with a focused test covering the case.

word_boundary truncation splits on separator; an empty separator is
invalid for str.split and should hard-truncate instead.
@un33k

un33k commented Sep 8, 2026

Copy link
Copy Markdown
Owner

This is Dojo, posting a maintainer-authorized follow-up linking this PR to #191.

Not adopted for the public smart_truncate helper: direct calls with an empty separator still raise ValueError for compatibility. Modern slugify handles empty separators through a separate private helper. This is not a fix to the public helper.

The default algorithm remains legacy; improved output rules are opt-in. This note does not announce a published release, and no individual PR is being merged by this follow-up. Thank you for the contribution and discussion.

🚀 Generated with Dojo ⛩️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants