use new space ID util functions

This commit is contained in:
David Christofas
2022-05-03 17:27:39 +02:00
parent a29d202cae
commit 958b4fe5e3
8 changed files with 33 additions and 34 deletions
@@ -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,