Skip to content

fix: update unEscapeSpecialChars to use regex for unescaping special …#6608

Open
Abhiiishek44 wants to merge 2 commits into
FlowiseAI:mainfrom
Abhiiishek44:fix/redis-metadata-unescape
Open

fix: update unEscapeSpecialChars to use regex for unescaping special …#6608
Abhiiishek44 wants to merge 2 commits into
FlowiseAI:mainfrom
Abhiiishek44:fix/redis-metadata-unescape

Conversation

@Abhiiishek44

Copy link
Copy Markdown

Description

This PR fixes metadata parsing in the Redis vector store when stored metadata contains RediSearch-reserved special characters.

The current unEscapeSpecialChars implementation only removes escaping from hyphens. Other escaped characters, including colons and quotes, remain unchanged when metadata is retrieved. Since the metadata is later passed to JSON.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

  • Updated unEscapeSpecialChars in the Redis vector store utilities
  • Added support for escaped RediSearch-reserved characters
  • Preserved unrelated backslashes
  • Kept the change limited to Redis metadata deserialization

Impact

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

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread packages/components/nodes/vectorstores/Redis/utils.ts Outdated
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.

Redis vector store: unEscapeSpecialChars only reverses -, causing JSON.parse failure on metadata read

1 participant