diff --git a/accounts/pkg/indexer/index/cs3/autoincrement.go b/accounts/pkg/indexer/index/cs3/autoincrement.go index 25351f6a6e..4fab26708b 100644 --- a/accounts/pkg/indexer/index/cs3/autoincrement.go +++ b/accounts/pkg/indexer/index/cs3/autoincrement.go @@ -154,6 +154,9 @@ func (idx Autoincrement) Add(id, v string) (string, error) { // Remove a value v from an index. func (idx Autoincrement) Remove(id string, v string) error { + if v == "" { + return nil + } searchPath := path.Join(idx.indexRootDir, v) _, err := idx.resolveSymlink(searchPath) if err != nil { diff --git a/accounts/pkg/indexer/index/cs3/non_unique.go b/accounts/pkg/indexer/index/cs3/non_unique.go index 50233b7bd9..21949c3f4e 100644 --- a/accounts/pkg/indexer/index/cs3/non_unique.go +++ b/accounts/pkg/indexer/index/cs3/non_unique.go @@ -169,6 +169,9 @@ func (idx *NonUnique) Add(id, v string) (string, error) { // Remove a value v from an index. func (idx *NonUnique) Remove(id string, v string) error { + if v == "" { + return nil + } ctx, err := idx.getAuthenticatedContext(context.Background()) if err != nil { return err diff --git a/accounts/pkg/indexer/index/cs3/unique.go b/accounts/pkg/indexer/index/cs3/unique.go index 3528c29a42..efc1f3adcd 100644 --- a/accounts/pkg/indexer/index/cs3/unique.go +++ b/accounts/pkg/indexer/index/cs3/unique.go @@ -155,6 +155,9 @@ func (idx *Unique) Add(id, v string) (string, error) { // Remove a value v from an index. func (idx *Unique) Remove(id string, v string) error { + if v == "" { + return nil + } searchPath := path.Join(idx.indexRootDir, v) _, err := idx.resolveSymlink(searchPath) if err != nil { diff --git a/accounts/pkg/indexer/index/disk/autoincrement.go b/accounts/pkg/indexer/index/disk/autoincrement.go index 200bc0c300..4cba7eba71 100644 --- a/accounts/pkg/indexer/index/disk/autoincrement.go +++ b/accounts/pkg/indexer/index/disk/autoincrement.go @@ -128,6 +128,9 @@ func (idx Autoincrement) Add(id, v string) (string, error) { // Remove a value v from an index. func (idx Autoincrement) Remove(id string, v string) error { + if v == "" { + return nil + } searchPath := path.Join(idx.indexRootDir, v) return os.Remove(searchPath) } diff --git a/accounts/pkg/indexer/index/disk/non_unique.go b/accounts/pkg/indexer/index/disk/non_unique.go index ac2041a8c1..70e0fcef5c 100644 --- a/accounts/pkg/indexer/index/disk/non_unique.go +++ b/accounts/pkg/indexer/index/disk/non_unique.go @@ -113,6 +113,9 @@ func (idx NonUniqueIndex) Add(id, v string) (string, error) { // Remove a value v from an index. func (idx NonUniqueIndex) Remove(id string, v string) error { + if v == "" { + return nil + } res, err := filepath.Glob(path.Join(idx.indexRootDir, "/*/", id)) if err != nil { return err diff --git a/accounts/pkg/indexer/index/disk/unique.go b/accounts/pkg/indexer/index/disk/unique.go index 482b6e1015..5adcd56a5b 100644 --- a/accounts/pkg/indexer/index/disk/unique.go +++ b/accounts/pkg/indexer/index/disk/unique.go @@ -93,6 +93,9 @@ func (idx Unique) Add(id, v string) (string, error) { // Remove a value v from an index. func (idx Unique) Remove(id string, v string) (err error) { + if v == "" { + return nil + } searchPath := path.Join(idx.indexRootDir, v) return os.Remove(searchPath) }