From 48fc735a30ed9c40a4c6086a201a63c281ced9ba Mon Sep 17 00:00:00 2001 From: Gianmaria Del Monte Date: Fri, 1 Dec 2023 15:51:47 +0100 Subject: [PATCH] use base32 for encoding the space id --- internal/grpc/services/spacesregistry/spacesregistry.go | 4 ++-- internal/http/services/owncloud/ocdav/dav.go | 4 ++-- internal/http/services/owncloud/ocgraph/drives.go | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/grpc/services/spacesregistry/spacesregistry.go b/internal/grpc/services/spacesregistry/spacesregistry.go index f4082bf52b..c44230e30d 100644 --- a/internal/grpc/services/spacesregistry/spacesregistry.go +++ b/internal/grpc/services/spacesregistry/spacesregistry.go @@ -20,7 +20,7 @@ package spacesregistry import ( "context" - "encoding/base64" + "encoding/base32" "errors" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" @@ -97,7 +97,7 @@ func (s *service) ListStorageSpaces(ctx context.Context, req *provider.ListStora for _, s := range spaces { s.Id = &provider.StorageSpaceId{ - OpaqueId: base64.StdEncoding.EncodeToString([]byte(s.RootInfo.Path)), + OpaqueId: base32.StdEncoding.EncodeToString([]byte(s.RootInfo.Path)), } } return &provider.ListStorageSpacesResponse{ diff --git a/internal/http/services/owncloud/ocdav/dav.go b/internal/http/services/owncloud/ocdav/dav.go index 71955fde29..f5534c0872 100644 --- a/internal/http/services/owncloud/ocdav/dav.go +++ b/internal/http/services/owncloud/ocdav/dav.go @@ -20,7 +20,7 @@ package ocdav import ( "context" - "encoding/base64" + "encoding/base32" "net/http" "path" "path/filepath" @@ -344,7 +344,7 @@ func (h *DavHandler) Handler(s *svc) http.Handler { } func getSpacePath(spaceID string) (string, error) { - decoded, err := base64.StdEncoding.DecodeString(spaceID) + decoded, err := base32.StdEncoding.DecodeString(spaceID) if err != nil { return "", err } diff --git a/internal/http/services/owncloud/ocgraph/drives.go b/internal/http/services/owncloud/ocgraph/drives.go index 61e4eb02d6..6b2284dacf 100644 --- a/internal/http/services/owncloud/ocgraph/drives.go +++ b/internal/http/services/owncloud/ocgraph/drives.go @@ -22,7 +22,7 @@ package ocgraph import ( "context" - "encoding/base64" + "encoding/base32" "encoding/json" "fmt" "net/http" @@ -156,8 +156,8 @@ func getDrivesForShares(ctx context.Context, gw gateway.GatewayAPIClient) ([]*li } // the prefix of the remote_item.id and rootid - idPrefix := base64.StdEncoding.EncodeToString([]byte(stat.Info.Path)) - resourceIdEnc := base64.StdEncoding.EncodeToString([]byte(resourceid.OwnCloudResourceIDWrap(stat.Info.Id))) + idPrefix := base32.StdEncoding.EncodeToString([]byte(stat.Info.Path)) + resourceIdEnc := base32.StdEncoding.EncodeToString([]byte(resourceid.OwnCloudResourceIDWrap(stat.Info.Id))) space := &libregraph.Drive{ Id: libregraph.PtrString(fmt.Sprintf("%s$%s!%s", shareJailID, shareJailID, share.Id.OpaqueId)),