Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FT.DROPINDEX doesn't work if index name contains special characters #2886

Open
ExposedCat opened this issue Jan 13, 2025 · 1 comment
Open

Comments

@ExposedCat
Copy link

ExposedCat commented Jan 13, 2025

Description

Having index index\ntest
This will fail FT.DROPINDEX index\ntest
This will work FT.DROPINDEX "index\ntest"

The library doesn't enclose names in " so client.dropIndex("index\ntest") fails

Node.js Version

v18.12.1

Redis Server Version

7.4.0

Node Redis Version

4.7.0

Platform

Linux

Logs

No response

@ExposedCat ExposedCat added the Bug label Jan 13, 2025
@bobymicroby
Copy link
Member

bobymicroby commented Jan 28, 2025

Hi @ExposedCat, thank you for the report!

I've tried to reproduce this issue using both 4.7.0 and the latest version with the following test case:

testUtils.testWithClient('client.ft.dropIndex', async client => {
  const [, reply] = await Promise.all([
    client.ft.create('index\ntest', {
      field: SCHEMA_FIELD_TYPE.TEXT
    }),
    client.ft.dropIndex('index\ntest') 
  ]);
});

The test passes successfully - I was able to both create and drop an index containing a newline character without any explicit quoting needed. The command encoding appears to be handling special characters correctly.

That said, I tested this on OSX / v23.1.0, not on Linux / v18.12.1 as in your environment. Could you try running packages/search/lib/commands/DROPINDEX.spec.ts locally with modified index names and share the test output with us?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants