You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
chore: guard against inherited properties
This commit is contained in:
@@ -42,6 +42,9 @@ module.exports = function createClient (portArg, hostArg, options) {
|
||||
if (parsed.search !== '') {
|
||||
var elem
|
||||
for (elem in parsed.query) {
|
||||
if (!parsed.query.hasOwnProperty(elem)) {
|
||||
continue
|
||||
}
|
||||
// If options are passed twice, only the parsed options will be used
|
||||
if (elem in options) {
|
||||
if (options[elem] === parsed.query[elem]) {
|
||||
|
@@ -85,7 +85,9 @@ RedisClient.prototype.duplicate = function (options, callback) {
|
||||
const existingOptions = utils.clone(this.options)
|
||||
options = utils.clone(options)
|
||||
for (const elem in options) {
|
||||
existingOptions[elem] = options[elem]
|
||||
if (options.hasOwnProperty(elem)) {
|
||||
existingOptions[elem] = options[elem]
|
||||
}
|
||||
}
|
||||
const client = new RedisClient(existingOptions)
|
||||
client.selectedDb = this.selectedDb
|
||||
|
@@ -72,13 +72,15 @@ function onReady (client) {
|
||||
if (!client.options.disableResubscribing && callbackCount) {
|
||||
debug('Sending pub/sub onReady commands')
|
||||
for (const key in client.subscriptionSet) {
|
||||
const command = key.slice(0, key.indexOf('_'))
|
||||
const args = client.subscriptionSet[key]
|
||||
client[command]([args]).catch((err) => {
|
||||
if (!client.closing) {
|
||||
process.nextTick(() => client.emit('error', err))
|
||||
}
|
||||
})
|
||||
if (client.subscriptionSet.hasOwnProperty(key)) {
|
||||
const command = key.slice(0, key.indexOf('_'))
|
||||
const args = client.subscriptionSet[key]
|
||||
client[command]([args]).catch((err) => {
|
||||
if (!client.closing) {
|
||||
process.nextTick(() => client.emit('error', err))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
client.sendOfflineQueue()
|
||||
|
Reference in New Issue
Block a user