Skip to content

Commit b85e3fb

Browse files
committed
Strip surrounding quotes from slash command arguments
When users type /add '/path/to file' the quotes were included as part of the path, causing "Path does not exist" errors. Now single and double quotes wrapping the argument are stripped.
1 parent 620f714 commit b85e3fb

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

openkb/agent/chat.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,9 @@ async def _handle_slash(
320320
parts = cmd.split(maxsplit=1)
321321
head = parts[0].lower()
322322
arg = parts[1].strip() if len(parts) > 1 else ""
323+
# Strip surrounding quotes (user may type /add '/path/to file')
324+
if len(arg) >= 2 and arg[0] == arg[-1] and arg[0] in ("'", '"'):
325+
arg = arg[1:-1]
323326

324327
if head in ("/exit", "/quit"):
325328
_fmt(style, ("class:header", "Bye. Thanks for using OpenKB.\n\n"))

0 commit comments

Comments
 (0)