From 1f38ff4877db6d0ae348330e25203beab51b7d1f Mon Sep 17 00:00:00 2001 From: Greyson LaLonde Date: Sun, 15 Mar 2026 10:28:27 -0400 Subject: [PATCH] fix: use dynamic separator in slugify for dedup and strip --- lib/crewai/src/crewai/utilities/string_utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/crewai/src/crewai/utilities/string_utils.py b/lib/crewai/src/crewai/utilities/string_utils.py index d5f0c9367..fc5d12a4b 100644 --- a/lib/crewai/src/crewai/utilities/string_utils.py +++ b/lib/crewai/src/crewai/utilities/string_utils.py @@ -67,8 +67,9 @@ def slugify(text: str, separator: str = "_") -> str: text = text.lower() text = _QUOTE_PATTERN.sub("", text) text = _DISALLOWED_CHARS_PATTERN.sub(separator, text) - text = _DUPLICATE_SEPARATOR_PATTERN.sub(separator, text) - return text.strip("-_") + escaped_sep = re.escape(separator) + text = re.sub(f"(?:{escaped_sep}){{2,}}", separator, text) + return text.strip(separator) def interpolate_only(