mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-05 14:20:13 +01:00
fix: redis hget
'node_redis: The HGET command contains a invalid argument type.\n' + 'Only strings, dates and buffers are accepted. Please update your code to use valid argument types.'
This commit is contained in:
@@ -75,7 +75,7 @@ module.exports = function (module) {
|
|||||||
if (cachedData[key]) {
|
if (cachedData[key]) {
|
||||||
return cachedData[key].hasOwnProperty(field) ? cachedData[key][field] : null;
|
return cachedData[key].hasOwnProperty(field) ? cachedData[key][field] : null;
|
||||||
}
|
}
|
||||||
return await module.client.async.hget(key, field);
|
return await module.client.async.hget(key, String(field));
|
||||||
};
|
};
|
||||||
|
|
||||||
module.getObjectFields = async function (key, fields) {
|
module.getObjectFields = async function (key, fields) {
|
||||||
|
|||||||
@@ -211,6 +211,11 @@ describe('Hash methods', function () {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should return null and not error', async () => {
|
||||||
|
const data = await db.getObjectField('hashTestObject', ['field1', 'field2']);
|
||||||
|
assert.strictEqual(data, null);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getObjectFields()', function () {
|
describe('getObjectFields()', function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user