Skip to content

Commit 83e67de

Browse files
author
arthosofteq
authored
Merge pull request #1417 from RedisInsight/be/bugfix/RI-3790-key-not-found-error
#RI-3790 Fix key name returned for keys list with search w\o glob pat…
2 parents 4de575b + 3ae485a commit 83e67de

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

redisinsight/api/src/modules/browser/services/keys-business/scanner/strategies/cluster.strategy.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ describe('Cluster Scanner Strategy', () => {
943943
scanned: 10,
944944
},
945945
]);
946-
expect(strategy.getKeyInfo).toHaveBeenCalledWith(clusterClient, key);
946+
expect(strategy.getKeyInfo).toHaveBeenCalledWith(clusterClient, Buffer.from(key));
947947
expect(strategy.scanNodes).not.toHaveBeenCalled();
948948
});
949949
it('should find exact key when match is escaped glob patter', async () => {
@@ -973,7 +973,7 @@ describe('Cluster Scanner Strategy', () => {
973973
scanned: 10,
974974
},
975975
]);
976-
expect(strategy.getKeyInfo).toHaveBeenCalledWith(clusterClient, searchPattern);
976+
expect(strategy.getKeyInfo).toHaveBeenCalledWith(clusterClient, Buffer.from(searchPattern));
977977
expect(strategy.scanNodes).not.toHaveBeenCalled();
978978
});
979979
it('should find exact key with correct type', async () => {

redisinsight/api/src/modules/browser/services/keys-business/scanner/strategies/cluster.strategy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export class ClusterStrategy extends AbstractStrategy {
4949
await this.calculateNodesTotalKeys(clientOptions, currentDbIndex, nodes);
5050

5151
if (!isGlob(match, { strict: false })) {
52-
const keyName = unescapeGlob(match);
52+
const keyName = Buffer.from(unescapeGlob(match));
5353
nodes.forEach((node) => {
5454
// eslint-disable-next-line no-param-reassign
5555
node.cursor = 0;

redisinsight/api/src/modules/browser/services/keys-business/scanner/strategies/standalone.strategy.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ describe('Standalone Scanner Strategy', () => {
476476
},
477477
]);
478478
expect(strategy.getKeysInfo).toHaveBeenCalledWith(nodeClient, [
479-
key,
479+
Buffer.from(key),
480480
]);
481481
expect(strategy.scan).not.toHaveBeenCalled();
482482
});
@@ -497,7 +497,7 @@ describe('Standalone Scanner Strategy', () => {
497497
keys: [{ ...getKeyInfoResponse, name: mockSearchPattern }],
498498
},
499499
]);
500-
expect(strategy.getKeysInfo).toHaveBeenCalledWith(nodeClient, [mockSearchPattern]);
500+
expect(strategy.getKeysInfo).toHaveBeenCalledWith(nodeClient, [Buffer.from(mockSearchPattern)]);
501501
expect(strategy.scan).not.toHaveBeenCalled();
502502
});
503503
it('should find exact key with correct type', async () => {

redisinsight/api/src/modules/browser/services/keys-business/scanner/strategies/standalone.strategy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class StandaloneStrategy extends AbstractStrategy {
6262
}
6363

6464
if (!isGlob(match, { strict: false })) {
65-
const keyName = unescapeGlob(match);
65+
const keyName = Buffer.from(unescapeGlob(match));
6666
node.cursor = 0;
6767
node.scanned = isNull(node.total) ? 1 : node.total;
6868
node.keys = await this.getKeysInfo(client, [keyName]);

0 commit comments

Comments
 (0)