From 3a469c9e473822e6b1a156681243c71931ef7871 Mon Sep 17 00:00:00 2001 From: gambitier Date: Fri, 26 Jul 2024 00:26:00 +0530 Subject: [PATCH] fix(brokers/redis): correct address prefix check --- v2/broker/redis/redis.go | 2 +- v3/broker/redis/redis.go | 2 +- v4/broker/redis/redis.go | 2 +- v5/broker/redis/redis.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/v2/broker/redis/redis.go b/v2/broker/redis/redis.go index 9e6e178c..75a8be64 100644 --- a/v2/broker/redis/redis.go +++ b/v2/broker/redis/redis.go @@ -165,7 +165,7 @@ func (b *redisBroker) Connect() error { } else { addr = b.opts.Addrs[0] - if !strings.HasPrefix("redis://", addr) { + if !strings.HasPrefix(addr, "redis://") { addr = "redis://" + addr } } diff --git a/v3/broker/redis/redis.go b/v3/broker/redis/redis.go index 830ea0a3..8a9b2db5 100644 --- a/v3/broker/redis/redis.go +++ b/v3/broker/redis/redis.go @@ -165,7 +165,7 @@ func (b *redisBroker) Connect() error { } else { addr = b.opts.Addrs[0] - if !strings.HasPrefix("redis://", addr) { + if !strings.HasPrefix(addr, "redis://") { addr = "redis://" + addr } } diff --git a/v4/broker/redis/redis.go b/v4/broker/redis/redis.go index 1d3a1769..1b7cf182 100644 --- a/v4/broker/redis/redis.go +++ b/v4/broker/redis/redis.go @@ -165,7 +165,7 @@ func (b *redisBroker) Connect() error { } else { addr = b.opts.Addrs[0] - if !strings.HasPrefix("redis://", addr) { + if !strings.HasPrefix(addr, "redis://") { addr = "redis://" + addr } } diff --git a/v5/broker/redis/redis.go b/v5/broker/redis/redis.go index ba811288..e261ced2 100644 --- a/v5/broker/redis/redis.go +++ b/v5/broker/redis/redis.go @@ -165,7 +165,7 @@ func (b *redisBroker) Connect() error { } else { addr = b.opts.Addrs[0] - if !strings.HasPrefix("redis://", addr) { + if !strings.HasPrefix(addr, "redis://") { addr = "redis://" + addr } }