change providerv1beta1.Reference to pointer

Signed-off-by: Christian Richter <crichter@owncloud.com>
This commit is contained in:
Christian Richter
2024-07-12 12:00:18 +02:00
parent 58c3c66429
commit c99550984e
6 changed files with 17 additions and 17 deletions

View File

@@ -71,7 +71,7 @@ func (c *ContentConnector) GetFile(ctx context.Context, writer io.Writer) error
// Initiate download request
req := &providerv1beta1.InitiateFileDownloadRequest{
Ref: &wopiContext.FileReference,
Ref: wopiContext.FileReference,
}
if wopiContext.ViewMode == appproviderv1beta1.ViewMode_VIEW_MODE_VIEW_ONLY && wopiContext.ViewOnlyToken != "" {
@@ -206,7 +206,7 @@ func (c *ContentConnector) PutFile(ctx context.Context, stream io.Reader, stream
// We need a stat call on the target file in order to get both the lock
// (if any) and the current size of the file
statRes, err := c.gwc.Stat(ctx, &providerv1beta1.StatRequest{
Ref: &wopiContext.FileReference,
Ref: wopiContext.FileReference,
})
if err != nil {
logger.Error().Err(err).Msg("PutFile: stat failed")
@@ -254,7 +254,7 @@ func (c *ContentConnector) PutFile(ctx context.Context, stream io.Reader, stream
req := &providerv1beta1.InitiateFileUploadRequest{
Opaque: opaque,
Ref: &wopiContext.FileReference,
Ref: wopiContext.FileReference,
LockId: lockID,
Options: &providerv1beta1.InitiateFileUploadRequest_IfMatch{
IfMatch: statRes.GetInfo().GetEtag(),

View File

@@ -44,7 +44,7 @@ var _ = Describe("ContentConnector", func() {
wopiCtx = middleware.WopiContext{
AccessToken: "abcdef123456",
FileReference: providerv1beta1.Reference{
FileReference: &providerv1beta1.Reference{
ResourceId: &providerv1beta1.ResourceId{
StorageId: "abc",
OpaqueId: "12345",
@@ -178,7 +178,7 @@ var _ = Describe("ContentConnector", func() {
wopiCtx = middleware.WopiContext{
AccessToken: "abcdef123456",
ViewOnlyToken: "view.only.123456",
FileReference: providerv1beta1.Reference{
FileReference: &providerv1beta1.Reference{
ResourceId: &providerv1beta1.ResourceId{
StorageId: "abc",
OpaqueId: "12345",

View File

@@ -89,7 +89,7 @@ func (f *FileConnector) GetLock(ctx context.Context) (string, error) {
logger := zerolog.Ctx(ctx)
req := &providerv1beta1.GetLockRequest{
Ref: &wopiContext.FileReference,
Ref: wopiContext.FileReference,
}
resp, err := f.gwc.GetLock(ctx, req)
@@ -158,7 +158,7 @@ func (f *FileConnector) Lock(ctx context.Context, lockID, oldLockID string) (str
if oldLockID == "" {
// If the oldLockID is empty, this is a "LOCK" request
req := &providerv1beta1.SetLockRequest{
Ref: &wopiContext.FileReference,
Ref: wopiContext.FileReference,
Lock: &providerv1beta1.Lock{
LockId: lockID,
AppName: f.cfg.App.LockName + "." + f.cfg.App.Name,
@@ -179,7 +179,7 @@ func (f *FileConnector) Lock(ctx context.Context, lockID, oldLockID string) (str
// If the oldLockID isn't empty, this is a "UnlockAndRelock" request. We'll
// do a "RefreshLock" in reva and provide the old lock
req := &providerv1beta1.RefreshLockRequest{
Ref: &wopiContext.FileReference,
Ref: wopiContext.FileReference,
Lock: &providerv1beta1.Lock{
LockId: lockID,
AppName: f.cfg.App.LockName + "." + f.cfg.App.Name,
@@ -211,7 +211,7 @@ func (f *FileConnector) Lock(ctx context.Context, lockID, oldLockID string) (str
// In both cases, we need to get the current lock to return it in a
// 409 response if needed
req := &providerv1beta1.GetLockRequest{
Ref: &wopiContext.FileReference,
Ref: wopiContext.FileReference,
}
resp, err := f.gwc.GetLock(ctx, req)
@@ -292,7 +292,7 @@ func (f *FileConnector) RefreshLock(ctx context.Context, lockID string) (string,
}
req := &providerv1beta1.RefreshLockRequest{
Ref: &wopiContext.FileReference,
Ref: wopiContext.FileReference,
Lock: &providerv1beta1.Lock{
LockId: lockID,
AppName: f.cfg.App.LockName + "." + f.cfg.App.Name,
@@ -330,7 +330,7 @@ func (f *FileConnector) RefreshLock(ctx context.Context, lockID string) (string,
// Either the file is unlocked or there is no lock
// We need to return 409 with the current lock
req := &providerv1beta1.GetLockRequest{
Ref: &wopiContext.FileReference,
Ref: wopiContext.FileReference,
}
resp, err := f.gwc.GetLock(ctx, req)
@@ -400,7 +400,7 @@ func (f *FileConnector) UnLock(ctx context.Context, lockID string) (string, erro
}
req := &providerv1beta1.UnlockRequest{
Ref: &wopiContext.FileReference,
Ref: wopiContext.FileReference,
Lock: &providerv1beta1.Lock{
LockId: lockID,
AppName: f.cfg.App.LockName + "." + f.cfg.App.Name,
@@ -424,7 +424,7 @@ func (f *FileConnector) UnLock(ctx context.Context, lockID string) (string, erro
case rpcv1beta1.Code_CODE_LOCKED:
// We need to return 409 with the current lock
req := &providerv1beta1.GetLockRequest{
Ref: &wopiContext.FileReference,
Ref: wopiContext.FileReference,
}
resp, err := f.gwc.GetLock(ctx, req)
@@ -485,7 +485,7 @@ func (f *FileConnector) CheckFileInfo(ctx context.Context) (fileinfo.FileInfo, e
logger := zerolog.Ctx(ctx)
statRes, err := f.gwc.Stat(ctx, &providerv1beta1.StatRequest{
Ref: &wopiContext.FileReference,
Ref: wopiContext.FileReference,
})
if err != nil {
logger.Error().Err(err).Msg("CheckFileInfo: stat failed")

View File

@@ -39,7 +39,7 @@ var _ = Describe("FileConnector", func() {
wopiCtx = middleware.WopiContext{
AccessToken: "abcdef123456",
FileReference: providerv1beta1.Reference{
FileReference: &providerv1beta1.Reference{
ResourceId: &providerv1beta1.ResourceId{
StorageId: "abc",
OpaqueId: "12345",

View File

@@ -25,7 +25,7 @@ const (
type WopiContext struct {
AccessToken string
ViewOnlyToken string
FileReference providerv1beta1.Reference
FileReference *providerv1beta1.Reference
User *userv1beta1.User
ViewMode appproviderv1beta1.ViewMode
EditAppUrl string

View File

@@ -214,7 +214,7 @@ func (s *Service) OpenInApp(
wopiContext := middleware.WopiContext{
AccessToken: cryptedReqAccessToken,
ViewOnlyToken: utils.ReadPlainFromOpaque(req.GetOpaque(), "viewOnlyToken"),
FileReference: providerFileRef,
FileReference: &providerFileRef,
User: user,
ViewMode: req.GetViewMode(),
EditAppUrl: editAppURL,