Skip to content

Fix: whitespaces in search tool names#125

Merged
janepie merged 2 commits intomainfrom
fix/search-whitespace
Mar 10, 2026
Merged

Fix: whitespaces in search tool names#125
janepie merged 2 commits intomainfrom
fix/search-whitespace

Conversation

@janepie
Copy link
Member

@janepie janepie commented Mar 10, 2026

No description provided.

@janepie janepie requested a review from marcelklehr March 10, 2026 09:31

tool_func = make_tool(provider)
tool_func.__name__ = "search_" + provider['name'].lower()
tool_func.__name__ = re.sub(r"[^\w]+", '_', "search_" + provider['name'].lower())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turns out \w also includes non-ascii characters like ü for example, which are likely also not allowed.

So perhaps this ould be better:

Suggested change
tool_func.__name__ = re.sub(r"[^\w]+", '_', "search_" + provider['name'].lower())
tool_func.__name__ = re.sub(r"[^a-zA-Z0-9]+", '_', "search_" + provider['name'].lower())

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed, plus dashes and underscores :)

Signed-off-by: Jana Peper <jana.peper@nextcloud.com>
@janepie janepie force-pushed the fix/search-whitespace branch from caf722b to 2033417 Compare March 10, 2026 10:56
Co-authored-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: janepie <49834966+janepie@users.noreply.github.com>
@janepie janepie merged commit c9b3efd into main Mar 10, 2026
6 checks passed
@janepie janepie deleted the fix/search-whitespace branch March 10, 2026 12:37
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