From 657a6b9b9189932beb3b2fae77d8bd5b16271d06 Mon Sep 17 00:00:00 2001 From: Benedikt Kulmann Date: Mon, 14 Dec 2020 23:49:56 +0100 Subject: [PATCH] Set empty role ids array --- ocis-pkg/middleware/account.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ocis-pkg/middleware/account.go b/ocis-pkg/middleware/account.go index 50136668d78..c02ca9f30a8 100644 --- a/ocis-pkg/middleware/account.go +++ b/ocis-pkg/middleware/account.go @@ -2,6 +2,7 @@ package middleware import ( "context" + "encoding/json" "net/http" "github.com/cs3org/reva/pkg/token/manager/jwt" @@ -46,7 +47,8 @@ func ExtractAccountUUID(opts ...account.Option) func(http.Handler) http.Handler return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { token := r.Header.Get("x-access-token") if len(token) == 0 { - ctx := metadata.Set(r.Context(), RoleIDs, "") + roleIDsJSON, _ := json.Marshal([]string{}) + ctx := metadata.Set(r.Context(), RoleIDs, string(roleIDsJSON)) next.ServeHTTP(w, r.WithContext(ctx)) return }