Skip to content

Commit

Permalink
fix malformed uid string in getter
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Richter <[email protected]>
  • Loading branch information
dragonchaser committed Oct 12, 2022
1 parent ae7c58b commit a3dde25
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
9 changes: 9 additions & 0 deletions changelog/unreleased/fix-malformed-uid-string.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Bugfix: Fix malformed uid string in cache

The rediscache returns a uid in the format of `<tablename>uid:<someuid>` in the getter
this results in issues when trying to delete the key from the cache store, because
the Delete function will prepend the table name to the string which will not be resolvable in redis
(e.g. `<tablename><tablename>uid:<somuid>`)

https://github.com/cs3org/reva/pull/3338
https://github.com/owncloud/ocis/issues/4772
9 changes: 8 additions & 1 deletion pkg/storage/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,14 @@ func (cache cacheStore) List(opts ...microstore.ListOption) ([]string, error) {
microstore.ListFrom(cache.database, cache.table),
}
o = append(o, opts...)
return cache.s.List(o...)
keys, err := cache.s.List(o...)
if err != nil {
return nil, err
}
for i, key := range keys {
keys[i] = strings.TrimPrefix(key, cache.table)
}
return keys, nil
}

// Delete deletes the given key on the configured database and table of the underlying store
Expand Down

0 comments on commit a3dde25

Please sign in to comment.