From 805099b6938fad729436679c821cfae4f14c52d6 Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Thu, 28 Mar 2019 15:42:45 +0100 Subject: [PATCH] wal: don't use path.Base to get changegroup value If a changegroup contains a slash then it'll be cut the the last string after the slash --- internal/wal/changes.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/wal/changes.go b/internal/wal/changes.go index c47e476..bed5480 100644 --- a/internal/wal/changes.go +++ b/internal/wal/changes.go @@ -344,12 +344,12 @@ func (w *WalManager) watcher(ctx context.Context) error { switch ev.Type { case mvccpb.PUT: w.changes.Lock() - changeGroup := path.Base(string(ev.Kv.Key)) + changeGroup := strings.TrimPrefix(string(ev.Kv.Key), etcdChangeGroupsDir+"/") w.changes.putChangeGroup(changeGroup, ev.Kv.ModRevision) w.changes.Unlock() case mvccpb.DELETE: w.changes.Lock() - changeGroup := path.Base(string(ev.Kv.Key)) + changeGroup := strings.TrimPrefix(string(ev.Kv.Key), etcdChangeGroupsDir+"/") w.changes.removeChangeGroup(changeGroup) w.changes.Unlock() }