store/memory: fixup

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2021-07-15 12:11:55 +03:00
parent 1e43122660
commit f54658830d

View File

@ -77,12 +77,10 @@ func (m *memoryStore) list(prefix string, limit, offset uint) []string {
if !strings.HasPrefix(k, prefix) { if !strings.HasPrefix(k, prefix) {
continue continue
} }
if prefix == "" { allKeys[i] = strings.TrimPrefix(k, prefix)
allKeys[i] = strings.TrimPrefix(k, "/") if allKeys[i][0] == '/' {
} else { allKeys[i] = allKeys[i][1:]
allKeys[i] = strings.TrimPrefix(k, prefix)
} }
allKeys[i] = strings.TrimPrefix(allKeys[i], "/")
i++ i++
} }
if limit != 0 || offset != 0 { if limit != 0 || offset != 0 {