@@ -114,7 +114,7 @@ func cs3TimestampToTime(t *types.Timestamp) time.Time {
|
|||||||
|
|
||||||
func cs3ResourceToDriveItem(res *storageprovider.ResourceInfo) (*libregraph.DriveItem, error) {
|
func cs3ResourceToDriveItem(res *storageprovider.ResourceInfo) (*libregraph.DriveItem, error) {
|
||||||
size := new(int64)
|
size := new(int64)
|
||||||
*size = int64(res.Size) // uint64 -> int :boom:
|
*size = int64(res.Size) // TODO lurking overflow: make size of libregraph drive item use uint64
|
||||||
|
|
||||||
driveItem := &libregraph.DriveItem{
|
driveItem := &libregraph.DriveItem{
|
||||||
Id: &res.Id.OpaqueId,
|
Id: &res.Id.OpaqueId,
|
||||||
@@ -132,7 +132,8 @@ func cs3ResourceToDriveItem(res *storageprovider.ResourceInfo) (*libregraph.Driv
|
|||||||
driveItem.LastModifiedDateTime = &lastModified
|
driveItem.LastModifiedDateTime = &lastModified
|
||||||
}
|
}
|
||||||
if res.Type == storageprovider.ResourceType_RESOURCE_TYPE_FILE && res.MimeType != "" {
|
if res.Type == storageprovider.ResourceType_RESOURCE_TYPE_FILE && res.MimeType != "" {
|
||||||
driveItem.File = &libregraph.OpenGraphFile{ // FIXME We cannot use libregraph.File here because the openapi codegenerator autodetects 'File' as a go type ...
|
// We cannot use a libregraph.File here because the openapi codegenerator autodetects 'File' as a go type ...
|
||||||
|
driveItem.File = &libregraph.OpenGraphFile{
|
||||||
MimeType: &res.MimeType,
|
MimeType: &res.MimeType,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import (
|
|||||||
"github.com/go-chi/render"
|
"github.com/go-chi/render"
|
||||||
libregraph "github.com/owncloud/libre-graph-api-go"
|
libregraph "github.com/owncloud/libre-graph-api-go"
|
||||||
"github.com/owncloud/ocis/graph/pkg/service/v0/errorcode"
|
"github.com/owncloud/ocis/graph/pkg/service/v0/errorcode"
|
||||||
"github.com/owncloud/ocis/graph/pkg/service/v0/net/headers"
|
"github.com/owncloud/ocis/graph/pkg/service/v0/net"
|
||||||
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
|
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
|
||||||
sproto "github.com/owncloud/ocis/settings/pkg/proto/v0"
|
sproto "github.com/owncloud/ocis/settings/pkg/proto/v0"
|
||||||
settingsSvc "github.com/owncloud/ocis/settings/pkg/service/v0"
|
settingsSvc "github.com/owncloud/ocis/settings/pkg/service/v0"
|
||||||
@@ -524,11 +524,11 @@ func (g Graph) getExtendedSpaceProperties(ctx context.Context, space *storagepro
|
|||||||
return nil, fmt.Errorf("space does not support the spaces download protocol")
|
return nil, fmt.Errorf("space does not support the spaces download protocol")
|
||||||
}
|
}
|
||||||
|
|
||||||
httpReq, err := rhttp.NewRequest(ctx, "GET", ep, nil)
|
httpReq, err := rhttp.NewRequest(ctx, http.MethodGet, ep, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
httpReq.Header.Set(headers.TokenTransportHeader, tk)
|
httpReq.Header.Set(net.HeaderTokenTransport, tk)
|
||||||
|
|
||||||
httpClient := g.GetHTTPClient()
|
httpClient := g.GetHTTPClient()
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package net
|
||||||
|
|
||||||
|
const (
|
||||||
|
// "github.com/cs3org/reva/internal/http/services/datagateway" is internal so we redeclare it here
|
||||||
|
// HeaderTokenTransport holds the header key for the reva transfer token
|
||||||
|
HeaderTokenTransport = "X-Reva-Transfer"
|
||||||
|
// HeaderIfModifiedSince is used to mimic/pass on caching headers when using grpc
|
||||||
|
HeaderIfModifiedSince = "If-Modified-Since"
|
||||||
|
)
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package headers
|
|
||||||
|
|
||||||
const (
|
|
||||||
// "github.com/cs3org/reva/internal/http/services/datagateway" is internal so we redeclare it here
|
|
||||||
// TokenTransportHeader holds the header key for the reva transfer token
|
|
||||||
TokenTransportHeader = "X-Reva-Transfer"
|
|
||||||
// IfModifiedSince is used to mimic/pass on caching headers when using grpc
|
|
||||||
IfModifiedSince = "If-Modified-Since"
|
|
||||||
)
|
|
||||||
Reference in New Issue
Block a user