mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-28 23:09:46 -05:00
Merge pull request #3648 from owncloud/new-space-id-functions
[full-ci] use new space ID util functions
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
Change: Use new space ID util functions
|
||||
|
||||
Changed code to use the new space ID util functions so that everything works with the new spaces ID format.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/3648
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/cs3org/reva/v2/pkg/events"
|
||||
"github.com/cs3org/reva/v2/pkg/utils"
|
||||
"github.com/cs3org/reva/v2/pkg/storagespace"
|
||||
|
||||
group "github.com/cs3org/go-cs3apis/cs3/identity/group/v1beta1"
|
||||
user "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
|
||||
@@ -453,7 +453,7 @@ func extractFileDetails(ref *provider.Reference, owner *user.UserId) (string, st
|
||||
id, path := "", ""
|
||||
if ref != nil {
|
||||
path = ref.GetPath()
|
||||
id, _ = utils.FormatStorageSpaceReference(ref)
|
||||
id, _ = storagespace.FormatReference(ref)
|
||||
}
|
||||
|
||||
uid := ""
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
cs3rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
|
||||
storageprovider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
|
||||
"github.com/cs3org/reva/v2/pkg/utils/resourceid"
|
||||
"github.com/cs3org/reva/v2/pkg/storagespace"
|
||||
"github.com/go-chi/render"
|
||||
libregraph "github.com/owncloud/libre-graph-api-go"
|
||||
"github.com/owncloud/ocis/extensions/graph/pkg/service/v0/errorcode"
|
||||
@@ -113,7 +113,7 @@ func (g Graph) getRemoteItem(ctx context.Context, root *storageprovider.Resource
|
||||
return nil, err
|
||||
}
|
||||
|
||||
item.WebDavUrl = libregraph.PtrString(baseURL.String() + resourceid.OwnCloudResourceIDWrap(root))
|
||||
item.WebDavUrl = libregraph.PtrString(baseURL.String() + storagespace.FormatResourceID(*root))
|
||||
return item, nil
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ func cs3ResourceToDriveItem(res *storageprovider.ResourceInfo) (*libregraph.Driv
|
||||
*size = int64(res.Size) // TODO lurking overflow: make size of libregraph drive item use uint64
|
||||
|
||||
driveItem := &libregraph.DriveItem{
|
||||
Id: libregraph.PtrString(resourceid.OwnCloudResourceIDWrap(res.Id)),
|
||||
Id: libregraph.PtrString(storagespace.FormatResourceID(*res.Id)),
|
||||
Size: size,
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ func cs3ResourceToRemoteItem(res *storageprovider.ResourceInfo) (*libregraph.Rem
|
||||
*size = int64(res.Size) // TODO lurking overflow: make size of libregraph drive item use uint64
|
||||
|
||||
remoteItem := &libregraph.RemoteItem{
|
||||
Id: libregraph.PtrString(resourceid.OwnCloudResourceIDWrap(res.Id)),
|
||||
Id: libregraph.PtrString(storagespace.FormatResourceID(*res.Id)),
|
||||
Size: size,
|
||||
}
|
||||
|
||||
@@ -219,7 +219,8 @@ func (g Graph) GetExtendedSpaceProperties(ctx context.Context, baseURL *url.URL,
|
||||
|
||||
for _, itemName := range names {
|
||||
if itemID, ok := metadata[itemName]; ok {
|
||||
spaceItem := g.getSpecialDriveItem(ctx, *resourceid.OwnCloudResourceIDUnwrap(string(itemID.Value)), itemName, baseURL, space)
|
||||
rid, _ := storagespace.ParseID(string(itemID.Value))
|
||||
spaceItem := g.getSpecialDriveItem(ctx, rid, itemName, baseURL, space)
|
||||
if spaceItem != nil {
|
||||
spaceItems = append(spaceItems, *spaceItem)
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ import (
|
||||
storageprovider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
|
||||
ctxpkg "github.com/cs3org/reva/v2/pkg/ctx"
|
||||
"github.com/cs3org/reva/v2/pkg/storagespace"
|
||||
"github.com/cs3org/reva/v2/pkg/utils"
|
||||
"github.com/cs3org/reva/v2/pkg/utils/resourceid"
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/go-chi/render"
|
||||
libregraph "github.com/owncloud/libre-graph-api-go"
|
||||
@@ -287,7 +287,7 @@ func (g Graph) UpdateDrive(w http.ResponseWriter, r *http.Request) {
|
||||
identifierParts := strings.Split(driveID, "!")
|
||||
switch len(identifierParts) {
|
||||
case 1:
|
||||
sID, _ := resourceid.StorageIDUnwrap(identifierParts[0])
|
||||
_, sID := storagespace.SplitStorageID(identifierParts[0])
|
||||
root.StorageId, root.OpaqueId = identifierParts[0], sID
|
||||
case 2:
|
||||
root.StorageId, root.OpaqueId = identifierParts[0], identifierParts[1]
|
||||
@@ -453,7 +453,7 @@ func generateSpaceId(id *storageprovider.ResourceId) (spaceID string) {
|
||||
// 2nd ID to compare is the opaque ID of the Space Root
|
||||
spaceID2 := id.GetOpaqueId()
|
||||
if strings.Contains(spaceID, "$") {
|
||||
spaceID2, _ = resourceid.StorageIDUnwrap(spaceID)
|
||||
_, spaceID2 = storagespace.SplitStorageID(spaceID)
|
||||
}
|
||||
// Append opaqueID only if it is different from the spaceID2
|
||||
if id.OpaqueId != spaceID2 {
|
||||
@@ -531,7 +531,7 @@ func (g Graph) cs3StorageSpaceToDrive(ctx context.Context, baseURL *url.URL, spa
|
||||
//"description": "string", // TODO read from StorageSpace ... needs Opaque for now
|
||||
DriveType: &space.SpaceType,
|
||||
Root: &libregraph.DriveItem{
|
||||
Id: libregraph.PtrString(resourceid.OwnCloudResourceIDWrap(space.Root)),
|
||||
Id: libregraph.PtrString(storagespace.FormatResourceID(*space.Root)),
|
||||
Permissions: permissions,
|
||||
},
|
||||
}
|
||||
@@ -764,7 +764,7 @@ func (g Graph) DeleteDrive(w http.ResponseWriter, r *http.Request) {
|
||||
root := &storageprovider.ResourceId{}
|
||||
|
||||
identifierParts := strings.Split(driveID, "!")
|
||||
sID, _ := resourceid.StorageIDUnwrap(identifierParts[0])
|
||||
_, sID := storagespace.SplitStorageID(identifierParts[0])
|
||||
switch len(identifierParts) {
|
||||
case 1:
|
||||
root.StorageId, root.OpaqueId = identifierParts[0], sID
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
revactx "github.com/cs3org/reva/v2/pkg/ctx"
|
||||
"github.com/cs3org/reva/v2/pkg/storagespace"
|
||||
"github.com/golang-jwt/jwt/v4"
|
||||
"github.com/owncloud/ocis/extensions/thumbnails/pkg/preprocessor"
|
||||
"github.com/owncloud/ocis/extensions/thumbnails/pkg/service/grpc/v0/decorators"
|
||||
@@ -257,15 +258,11 @@ func (g Thumbnail) stat(path, auth string) (*provider.StatResponse, error) {
|
||||
|
||||
var ref *provider.Reference
|
||||
if strings.Contains(path, "!") {
|
||||
parts := strings.Split(path, "!")
|
||||
spaceID, path := parts[0], parts[1]
|
||||
ref = &provider.Reference{
|
||||
ResourceId: &provider.ResourceId{
|
||||
StorageId: spaceID,
|
||||
OpaqueId: spaceID,
|
||||
},
|
||||
Path: path,
|
||||
parsed, err := storagespace.ParseReference(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ref = &parsed
|
||||
} else {
|
||||
ref = &provider.Reference{
|
||||
Path: path,
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
revactx "github.com/cs3org/reva/v2/pkg/ctx"
|
||||
"github.com/cs3org/reva/v2/pkg/rhttp"
|
||||
"github.com/cs3org/reva/v2/pkg/storagespace"
|
||||
"github.com/owncloud/ocis/extensions/thumbnails/pkg/config"
|
||||
"github.com/pkg/errors"
|
||||
"google.golang.org/grpc/metadata"
|
||||
@@ -45,16 +46,11 @@ func (s CS3) Get(ctx context.Context, path string) (io.ReadCloser, error) {
|
||||
}
|
||||
var ref *provider.Reference
|
||||
if strings.Contains(path, "!") {
|
||||
parts := strings.Split(path, "!")
|
||||
spaceID, path := parts[0], parts[1]
|
||||
ref = &provider.Reference{
|
||||
ResourceId: &provider.ResourceId{
|
||||
StorageId: spaceID,
|
||||
OpaqueId: spaceID,
|
||||
},
|
||||
// Spaces requests need relative paths.
|
||||
Path: "." + path,
|
||||
parsed, err := storagespace.ParseReference(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ref = &parsed
|
||||
} else {
|
||||
ref = &provider.Reference{
|
||||
Path: path,
|
||||
|
||||
@@ -10,7 +10,7 @@ require (
|
||||
github.com/blevesearch/bleve_index_api v1.0.1
|
||||
github.com/coreos/go-oidc/v3 v3.1.0
|
||||
github.com/cs3org/go-cs3apis v0.0.0-20220412090512-93c5918b4bde
|
||||
github.com/cs3org/reva/v2 v2.0.0-20220503062800-28d8d2578a8f
|
||||
github.com/cs3org/reva/v2 v2.0.0-20220503122729-afc8ead0c9a6
|
||||
github.com/disintegration/imaging v1.6.2
|
||||
github.com/glauth/glauth/v2 v2.0.0-20211021011345-ef3151c28733
|
||||
github.com/go-chi/chi/v5 v5.0.7
|
||||
|
||||
@@ -236,6 +236,8 @@ github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc/go.mod h1:paBW
|
||||
github.com/boombuler/barcode v1.0.1 h1:NDBbPmhS+EqABEs5Kg3n/5ZNjy73Pz7SIV+KCeqyXcs=
|
||||
github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
|
||||
github.com/c-bata/go-prompt v0.2.5/go.mod h1:vFnjEGDIIA/Lib7giyE4E9c50Lvl8j0S+7FVlAwDAVw=
|
||||
github.com/c0rby/reva/v2 v2.0.0-20220502195635-b3d192b975d0 h1:r4XeggvJMiYTugpgmPsOWF/ulRFUHOj/oWep/5Q+xZY=
|
||||
github.com/c0rby/reva/v2 v2.0.0-20220502195635-b3d192b975d0/go.mod h1:2e/4HcIy54Mic3V7Ow0bz4n5dkZU0dHIZSWomFe5vng=
|
||||
github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=
|
||||
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
|
||||
github.com/cenkalti/backoff/v4 v4.1.0/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
|
||||
@@ -318,10 +320,8 @@ github.com/cs3org/go-cs3apis v0.0.0-20220412090512-93c5918b4bde h1:WrD9O8ZaWvsm0
|
||||
github.com/cs3org/go-cs3apis v0.0.0-20220412090512-93c5918b4bde/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY=
|
||||
github.com/cs3org/reva v1.18.0 h1:MbPS5ZAa8RzKcTxAVeSDdISB3XXqLIxqB03BTN5ReBY=
|
||||
github.com/cs3org/reva v1.18.0/go.mod h1:e5VDUDu4vVWIeVkZcW//n6UZzhGGMa+Tz/whCiX3N6o=
|
||||
github.com/cs3org/reva/v2 v2.0.0-20220502122639-bfbf8690a043 h1:wAvf45pBDnWIN4kpyWpD9uRl9y147ioAXJkfztrMSCM=
|
||||
github.com/cs3org/reva/v2 v2.0.0-20220502122639-bfbf8690a043/go.mod h1:2e/4HcIy54Mic3V7Ow0bz4n5dkZU0dHIZSWomFe5vng=
|
||||
github.com/cs3org/reva/v2 v2.0.0-20220503062800-28d8d2578a8f h1:3ge1ufZLjNni3FftOucKd0h9k9SGqzVoNnQ4Ssr03gQ=
|
||||
github.com/cs3org/reva/v2 v2.0.0-20220503062800-28d8d2578a8f/go.mod h1:2e/4HcIy54Mic3V7Ow0bz4n5dkZU0dHIZSWomFe5vng=
|
||||
github.com/cs3org/reva/v2 v2.0.0-20220503122729-afc8ead0c9a6 h1:7NmN0CkDNS+YDFPvT+n73f8WJHkRVG3OmPnOwWNPdlM=
|
||||
github.com/cs3org/reva/v2 v2.0.0-20220503122729-afc8ead0c9a6/go.mod h1:2e/4HcIy54Mic3V7Ow0bz4n5dkZU0dHIZSWomFe5vng=
|
||||
github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8 h1:Z9lwXumT5ACSmJ7WGnFl+OMLLjpz5uR2fyz7dC255FI=
|
||||
github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8/go.mod h1:4abs/jPXcmJzYoYGF91JF9Uq9s/KL5n1jvFDix8KcqY=
|
||||
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
|
||||
|
||||
Reference in New Issue
Block a user