fix: update unEscapeSpecialChars to use regex for unescaping special …#6608
fix: update unEscapeSpecialChars to use regex for unescaping special …#6608Abhiiishek44 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the unEscapeSpecialChars utility function in the Redis vector store component to unescape a broader set of special characters using a regular expression. The review feedback correctly identifies a critical issue where including double quotes in the character class can corrupt JSON-escaped strings and cause syntax errors during parsing, and provides a code suggestion to exclude double quotes from the regex.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Description
This PR fixes metadata parsing in the Redis vector store when stored metadata contains RediSearch-reserved special characters.
The current
unEscapeSpecialCharsimplementation only removes escaping from hyphens. Other escaped characters, including colons and quotes, remain unchanged when metadata is retrieved. Since the metadata is later passed toJSON.parse(), these remaining escape characters can cause parsing to fail during similarity search.The unescaping logic has been updated to handle all supported RediSearch-reserved characters instead of handling only hyphens. Unrelated backslashes are preserved so that normal string content is not modified.
Changes
unEscapeSpecialCharsin the Redis vector store utilitiesImpact
Redis vector store results containing metadata with characters such as
:,",-, and other reserved characters can now be parsed correctly without affecting existing metadata values.Fixes #6598