Skip to content

Commit

Permalink
use base32 for encoding the space id
Browse files Browse the repository at this point in the history
  • Loading branch information
gmgigi96 committed Dec 1, 2023
1 parent 6dbe2b2 commit 48fc735
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions internal/grpc/services/spacesregistry/spacesregistry.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package spacesregistry

import (
"context"
"encoding/base64"
"encoding/base32"
"errors"

provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
Expand Down Expand Up @@ -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{
Expand Down
4 changes: 2 additions & 2 deletions internal/http/services/owncloud/ocdav/dav.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package ocdav

import (
"context"
"encoding/base64"
"encoding/base32"
"net/http"
"path"
"path/filepath"
Expand Down Expand Up @@ -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
}
Expand Down
6 changes: 3 additions & 3 deletions internal/http/services/owncloud/ocgraph/drives.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ package ocgraph

import (
"context"
"encoding/base64"
"encoding/base32"
"encoding/json"
"fmt"
"net/http"
Expand Down Expand Up @@ -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)),
Expand Down

0 comments on commit 48fc735

Please sign in to comment.