address feedback

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
Jörn Friedrich Dreyer
2022-01-19 08:52:47 +00:00
parent 6e6c2a127b
commit 0dfb86e80e
4 changed files with 15 additions and 14 deletions

View File

@@ -114,7 +114,7 @@ func cs3TimestampToTime(t *types.Timestamp) time.Time {
func cs3ResourceToDriveItem(res *storageprovider.ResourceInfo) (*libregraph.DriveItem, error) {
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{
Id: &res.Id.OpaqueId,
@@ -132,7 +132,8 @@ func cs3ResourceToDriveItem(res *storageprovider.ResourceInfo) (*libregraph.Driv
driveItem.LastModifiedDateTime = &lastModified
}
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,
}
}

View File

@@ -24,7 +24,7 @@ import (
"github.com/go-chi/render"
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/net/headers"
"github.com/owncloud/ocis/graph/pkg/service/v0/net"
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
sproto "github.com/owncloud/ocis/settings/pkg/proto/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")
}
httpReq, err := rhttp.NewRequest(ctx, "GET", ep, nil)
httpReq, err := rhttp.NewRequest(ctx, http.MethodGet, ep, nil)
if err != nil {
return nil, err
}
httpReq.Header.Set(headers.TokenTransportHeader, tk)
httpReq.Header.Set(net.HeaderTokenTransport, tk)
httpClient := g.GetHTTPClient()

View File

@@ -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"
)

View File

@@ -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"
)