diff --git a/services/collaboration/pkg/connector/contentconnector.go b/services/collaboration/pkg/connector/contentconnector.go index 4d23c0f328..2bd16eaba1 100644 --- a/services/collaboration/pkg/connector/contentconnector.go +++ b/services/collaboration/pkg/connector/contentconnector.go @@ -51,12 +51,12 @@ func (c *ContentConnector) GetFile(ctx context.Context, writer io.Writer) error return err } - if resp.Status.Code != rpcv1beta1.Code_CODE_OK { + if resp.GetStatus().GetCode() != rpcv1beta1.Code_CODE_OK { logger.Error(). - Str("StatusCode", resp.Status.Code.String()). - Str("StatusMsg", resp.Status.Message). + Str("StatusCode", resp.GetStatus().GetCode().String()). + Str("StatusMsg", resp.GetStatus().GetMessage()). Msg("GetFile: InitiateFileDownload failed with wrong status") - return NewConnectorError(500, resp.Status.GetCode().String()+" "+resp.Status.GetMessage()) + return NewConnectorError(500, resp.GetStatus().GetCode().String()+" "+resp.GetStatus().GetMessage()) } // Figure out the download endpoint and download token @@ -64,11 +64,11 @@ func (c *ContentConnector) GetFile(ctx context.Context, writer io.Writer) error downloadToken := "" hasDownloadToken := false - for _, proto := range resp.Protocols { - if proto.Protocol == "simple" || proto.Protocol == "spaces" { - downloadEndpoint = proto.DownloadEndpoint - downloadToken = proto.Token - hasDownloadToken = proto.Token != "" + for _, proto := range resp.GetProtocols() { + if proto.GetProtocol() == "simple" || proto.GetProtocol() == "spaces" { + downloadEndpoint = proto.GetDownloadEndpoint() + downloadToken = proto.GetToken() + hasDownloadToken = proto.GetToken() != "" break } } @@ -160,28 +160,28 @@ func (c *ContentConnector) PutFile(ctx context.Context, stream io.Reader, stream return "", err } - if statRes.Status.Code != rpcv1beta1.Code_CODE_OK { + if statRes.GetStatus().GetCode() != rpcv1beta1.Code_CODE_OK { logger.Error(). - Str("StatusCode", statRes.Status.Code.String()). - Str("StatusMsg", statRes.Status.Message). + Str("StatusCode", statRes.GetStatus().GetCode().String()). + Str("StatusMsg", statRes.GetStatus().GetMessage()). Msg("PutFile: stat failed with unexpected status") - return "", NewConnectorError(500, statRes.Status.GetCode().String()+" "+statRes.Status.GetMessage()) + return "", NewConnectorError(500, statRes.GetStatus().GetCode().String()+" "+statRes.GetStatus().GetMessage()) } // If there is a lock and it mismatches, return 409 - if statRes.Info.Lock != nil && statRes.Info.Lock.LockId != lockID { + if statRes.GetInfo().GetLock() != nil && statRes.GetInfo().GetLock().GetLockId() != lockID { logger.Error(). - Str("LockID", statRes.Info.Lock.LockId). + Str("LockID", statRes.GetInfo().GetLock().GetLockId()). Msg("PutFile: wrong lock") // onlyoffice says it's required to send the current lockId, MS doesn't say anything - return statRes.Info.Lock.LockId, NewConnectorError(409, "Wrong lock") + return statRes.GetInfo().GetLock().GetLockId(), NewConnectorError(409, "Wrong lock") } // only unlocked uploads can go through if the target file is empty, // otherwise the X-WOPI-Lock header is required even if there is no lock on the file // This is part of the onlyoffice documentation (https://api.onlyoffice.com/editors/wopi/restapi/putfile) // Wopivalidator fails some tests if we don't also check for the X-WOPI-Lock header. - if lockID == "" && statRes.Info.Lock == nil && statRes.Info.Size > 0 { + if lockID == "" && statRes.GetInfo().GetLock() == nil && statRes.GetInfo().GetSize() > 0 { logger.Error().Msg("PutFile: file must be locked first") // onlyoffice says to send an empty string if the file is unlocked, MS doesn't say anything return "", NewConnectorError(409, "File must be locked first") @@ -204,7 +204,7 @@ func (c *ContentConnector) PutFile(ctx context.Context, stream io.Reader, stream Ref: &wopiContext.FileReference, LockId: lockID, Options: &providerv1beta1.InitiateFileUploadRequest_IfMatch{ - IfMatch: statRes.Info.Etag, + IfMatch: statRes.GetInfo().GetEtag(), }, } @@ -215,12 +215,12 @@ func (c *ContentConnector) PutFile(ctx context.Context, stream io.Reader, stream return "", err } - if resp.Status.Code != rpcv1beta1.Code_CODE_OK { + if resp.GetStatus().GetCode() != rpcv1beta1.Code_CODE_OK { logger.Error(). - Str("StatusCode", resp.Status.Code.String()). - Str("StatusMsg", resp.Status.Message). + Str("StatusCode", resp.GetStatus().GetCode().String()). + Str("StatusMsg", resp.GetStatus().GetMessage()). Msg("UploadHelper: InitiateFileUpload failed with wrong status") - return "", NewConnectorError(500, resp.Status.GetCode().String()+" "+resp.Status.GetMessage()) + return "", NewConnectorError(500, resp.GetStatus().GetCode().String()+" "+resp.GetStatus().GetMessage()) } // if the content length is greater than 0, we need to upload the content to the @@ -231,11 +231,11 @@ func (c *ContentConnector) PutFile(ctx context.Context, stream io.Reader, stream uploadToken := "" hasUploadToken := false - for _, proto := range resp.Protocols { - if proto.Protocol == "simple" || proto.Protocol == "spaces" { - uploadEndpoint = proto.UploadEndpoint - uploadToken = proto.Token - hasUploadToken = proto.Token != "" + for _, proto := range resp.GetProtocols() { + if proto.GetProtocol() == "simple" || proto.GetProtocol() == "spaces" { + uploadEndpoint = proto.GetUploadEndpoint() + uploadToken = proto.GetToken() + hasUploadToken = proto.GetToken() != "" break } } diff --git a/services/collaboration/pkg/connector/fileconnector.go b/services/collaboration/pkg/connector/fileconnector.go index fbe6e83e88..bc6f07f370 100644 --- a/services/collaboration/pkg/connector/fileconnector.go +++ b/services/collaboration/pkg/connector/fileconnector.go @@ -56,17 +56,17 @@ func (f *FileConnector) GetLock(ctx context.Context) (string, error) { return "", err } - if resp.Status.Code != rpcv1beta1.Code_CODE_OK { + if resp.GetStatus().GetCode() != rpcv1beta1.Code_CODE_OK { logger.Error(). - Str("StatusCode", resp.Status.GetCode().String()). - Str("StatusMsg", resp.Status.GetMessage()). + Str("StatusCode", resp.GetStatus().GetCode().String()). + Str("StatusMsg", resp.GetStatus().GetMessage()). Msg("GetLock failed with unexpected status") - return "", NewConnectorError(404, resp.Status.GetCode().String()+" "+resp.Status.GetMessage()) + return "", NewConnectorError(404, resp.GetStatus().GetCode().String()+" "+resp.GetStatus().GetMessage()) } lockID := "" - if resp.Lock != nil { - lockID = resp.Lock.LockId + if resp.GetLock() != nil { + lockID = resp.GetLock().GetLockId() } // log the success at debug level @@ -116,7 +116,7 @@ func (f *FileConnector) Lock(ctx context.Context, lockID, oldLockID string) (str logger.Error().Err(err).Msg("SetLock failed") return "", err } - setOrRefreshStatus = resp.Status + setOrRefreshStatus = resp.GetStatus() } else { // If the oldLockID isn't empty, this is a "UnlockAndRelock" request. We'll // do a "RefreshLock" in reva and provide the old lock @@ -138,11 +138,11 @@ func (f *FileConnector) Lock(ctx context.Context, lockID, oldLockID string) (str logger.Error().Err(err).Msg("UnlockAndRefresh failed") return "", err } - setOrRefreshStatus = resp.Status + setOrRefreshStatus = resp.GetStatus() } // we're checking the status of either the "SetLock" or "RefreshLock" operations - switch setOrRefreshStatus.Code { + switch setOrRefreshStatus.GetCode() { case rpcv1beta1.Code_CODE_OK: logger.Debug().Msg("SetLock successful") return "", nil @@ -162,20 +162,20 @@ func (f *FileConnector) Lock(ctx context.Context, lockID, oldLockID string) (str return "", err } - if resp.Status.Code != rpcv1beta1.Code_CODE_OK { + if resp.GetStatus().GetCode() != rpcv1beta1.Code_CODE_OK { logger.Error(). - Str("StatusCode", resp.Status.Code.String()). - Str("StatusMsg", resp.Status.Message). + Str("StatusCode", resp.GetStatus().GetCode().String()). + Str("StatusMsg", resp.GetStatus().GetMessage()). Msg("SetLock failed, fallback to GetLock failed with unexpected status") } - if resp.Lock != nil { - if resp.Lock.LockId != lockID { + if resp.GetLock() != nil { + if resp.GetLock().GetLockId() != lockID { // lockId is different -> return 409 with the current lockId logger.Warn(). - Str("LockID", resp.Lock.LockId). + Str("LockID", resp.GetLock().GetLockId()). Msg("SetLock conflict") - return resp.Lock.LockId, NewConnectorError(409, "Lock conflict") + return resp.GetLock().GetLockId(), NewConnectorError(409, "Lock conflict") } // TODO: according to the spec we need to treat this as a RefreshLock @@ -184,9 +184,9 @@ func (f *FileConnector) Lock(ctx context.Context, lockID, oldLockID string) (str // Since the lockId matches now, we'll assume success for now. // As said in the todo, we probably should send a "RefreshLock" request here. logger.Warn(). - Str("LockID", resp.Lock.LockId). + Str("LockID", resp.GetLock().GetLockId()). Msg("SetLock lock refreshed instead") - return resp.Lock.LockId, nil + return resp.GetLock().GetLockId(), nil } // TODO: Is this the right error code? @@ -195,8 +195,8 @@ func (f *FileConnector) Lock(ctx context.Context, lockID, oldLockID string) (str default: logger.Error(). - Str("StatusCode", setOrRefreshStatus.Code.String()). - Str("StatusMsg", setOrRefreshStatus.Message). + Str("StatusCode", setOrRefreshStatus.GetCode().String()). + Str("StatusMsg", setOrRefreshStatus.GetMessage()). Msg("SetLock failed with unexpected status") return "", NewConnectorError(500, setOrRefreshStatus.GetCode().String()+" "+setOrRefreshStatus.GetMessage()) } @@ -237,22 +237,22 @@ func (f *FileConnector) RefreshLock(ctx context.Context, lockID string) (string, return "", err } - switch resp.Status.Code { + switch resp.GetStatus().GetCode() { case rpcv1beta1.Code_CODE_OK: logger.Debug().Msg("RefreshLock successful") return "", nil case rpcv1beta1.Code_CODE_NOT_FOUND: logger.Error(). - Str("StatusCode", resp.Status.Code.String()). - Str("StatusMsg", resp.Status.Message). + Str("StatusCode", resp.GetStatus().GetCode().String()). + Str("StatusMsg", resp.GetStatus().GetMessage()). Msg("RefreshLock failed, file reference not found") return "", NewConnectorError(404, "File reference not found") case rpcv1beta1.Code_CODE_ABORTED: logger.Error(). - Str("StatusCode", resp.Status.Code.String()). - Str("StatusMsg", resp.Status.Message). + Str("StatusCode", resp.GetStatus().GetCode().String()). + Str("StatusMsg", resp.GetStatus().GetMessage()). Msg("RefreshLock failed, lock mismatch") // Either the file is unlocked or there is no lock @@ -267,35 +267,35 @@ func (f *FileConnector) RefreshLock(ctx context.Context, lockID string) (string, return "", err } - if resp.Status.Code != rpcv1beta1.Code_CODE_OK { + if resp.GetStatus().GetCode() != rpcv1beta1.Code_CODE_OK { logger.Error(). - Str("StatusCode", resp.Status.Code.String()). - Str("StatusMsg", resp.Status.Message). + Str("StatusCode", resp.GetStatus().GetCode().String()). + Str("StatusMsg", resp.GetStatus().GetMessage()). Msg("RefreshLock failed, tried to get the current lock failed with unexpected status") - return "", NewConnectorError(500, resp.Status.GetCode().String()+" "+resp.Status.GetMessage()) + return "", NewConnectorError(500, resp.GetStatus().GetCode().String()+" "+resp.GetStatus().GetMessage()) } - if resp.Lock == nil { + if resp.GetLock() == nil { logger.Error(). - Str("StatusCode", resp.Status.Code.String()). - Str("StatusMsg", resp.Status.Message). + Str("StatusCode", resp.GetStatus().GetCode().String()). + Str("StatusMsg", resp.GetStatus().GetMessage()). Msg("RefreshLock failed, no lock on file") return "", NewConnectorError(409, "No lock on file") } else { // lock is different than the one requested, otherwise we wouldn't reached this point logger.Error(). - Str("LockID", resp.Lock.LockId). - Str("StatusCode", resp.Status.Code.String()). - Str("StatusMsg", resp.Status.Message). + Str("LockID", resp.GetLock().GetLockId()). + Str("StatusCode", resp.GetStatus().GetCode().String()). + Str("StatusMsg", resp.GetStatus().GetMessage()). Msg("RefreshLock failed, lock mismatch") - return resp.Lock.LockId, NewConnectorError(409, "Lock mismatch") + return resp.GetLock().GetLockId(), NewConnectorError(409, "Lock mismatch") } default: logger.Error(). - Str("StatusCode", resp.Status.Code.String()). - Str("StatusMsg", resp.Status.Message). + Str("StatusCode", resp.GetStatus().GetCode().String()). + Str("StatusMsg", resp.GetStatus().GetMessage()). Msg("RefreshLock failed with unexpected status") - return "", NewConnectorError(500, resp.Status.GetCode().String()+" "+resp.Status.GetMessage()) + return "", NewConnectorError(500, resp.GetStatus().GetCode().String()+" "+resp.GetStatus().GetMessage()) } } @@ -330,7 +330,7 @@ func (f *FileConnector) UnLock(ctx context.Context, lockID string) (string, erro return "", err } - switch resp.Status.Code { + switch resp.GetStatus().GetCode() { case rpcv1beta1.Code_CODE_OK: logger.Debug().Msg("Unlock successful") return "", nil @@ -350,37 +350,37 @@ func (f *FileConnector) UnLock(ctx context.Context, lockID string) (string, erro return "", err } - if resp.Status.Code != rpcv1beta1.Code_CODE_OK { + if resp.GetStatus().GetCode() != rpcv1beta1.Code_CODE_OK { logger.Error(). - Str("StatusCode", resp.Status.Code.String()). - Str("StatusMsg", resp.Status.Message). + Str("StatusCode", resp.GetStatus().GetCode().String()). + Str("StatusMsg", resp.GetStatus().GetMessage()). Msg("Unlock failed, tried to get the current lock failed with unexpected status") - return "", NewConnectorError(500, resp.Status.GetCode().String()+" "+resp.Status.GetMessage()) + return "", NewConnectorError(500, resp.GetStatus().GetCode().String()+" "+resp.GetStatus().GetMessage()) } var outLockId string - if resp.Lock == nil { + if resp.GetLock() == nil { logger.Error(). - Str("StatusCode", resp.Status.Code.String()). - Str("StatusMsg", resp.Status.Message). + Str("StatusCode", resp.GetStatus().GetCode().String()). + Str("StatusMsg", resp.GetStatus().GetMessage()). Msg("Unlock failed, no lock on file") outLockId = "" } else { // lock is different than the one requested, otherwise we wouldn't reached this point logger.Error(). - Str("LockID", resp.Lock.LockId). - Str("StatusCode", resp.Status.Code.String()). - Str("StatusMsg", resp.Status.Message). + Str("LockID", resp.GetLock().GetLockId()). + Str("StatusCode", resp.GetStatus().GetCode().String()). + Str("StatusMsg", resp.GetStatus().GetMessage()). Msg("Unlock failed, lock mismatch") - outLockId = resp.Lock.LockId + outLockId = resp.GetLock().GetLockId() } return outLockId, NewConnectorError(409, "Lock mismatch") default: logger.Error(). - Str("StatusCode", resp.Status.Code.String()). - Str("StatusMsg", resp.Status.Message). + Str("StatusCode", resp.GetStatus().GetCode().String()). + Str("StatusMsg", resp.GetStatus().GetMessage()). Msg("Unlock failed with unexpected status") - return "", NewConnectorError(500, resp.Status.GetCode().String()+" "+resp.Status.GetMessage()) + return "", NewConnectorError(500, resp.GetStatus().GetCode().String()+" "+resp.GetStatus().GetMessage()) } } @@ -402,21 +402,21 @@ func (f *FileConnector) CheckFileInfo(ctx context.Context) (FileInfo, error) { return FileInfo{}, err } - if statRes.Status.Code != rpcv1beta1.Code_CODE_OK { + if statRes.GetStatus().GetCode() != rpcv1beta1.Code_CODE_OK { logger.Error(). - Str("StatusCode", statRes.Status.Code.String()). - Str("StatusMsg", statRes.Status.Message). + Str("StatusCode", statRes.GetStatus().GetCode().String()). + Str("StatusMsg", statRes.GetStatus().GetMessage()). Msg("CheckFileInfo: stat failed with unexpected status") - return FileInfo{}, NewConnectorError(500, statRes.Status.GetCode().String()+" "+statRes.Status.GetMessage()) + return FileInfo{}, NewConnectorError(500, statRes.GetStatus().GetCode().String()+" "+statRes.GetStatus().GetMessage()) } fileInfo := FileInfo{ // OwnerId must use only alphanumeric chars (https://learn.microsoft.com/en-us/microsoft-365/cloud-storage-partner-program/rest/files/checkfileinfo/checkfileinfo-response#requirements-for-user-identity-properties) - OwnerId: hex.EncodeToString([]byte(statRes.Info.Owner.OpaqueId + "@" + statRes.Info.Owner.Idp)), - Size: int64(statRes.Info.Size), - Version: statRes.Info.Mtime.String(), - BaseFileName: path.Base(statRes.Info.Path), - BreadcrumbDocName: path.Base(statRes.Info.Path), + OwnerId: hex.EncodeToString([]byte(statRes.GetInfo().GetOwner().GetOpaqueId() + "@" + statRes.GetInfo().GetOwner().GetIdp())), + Size: int64(statRes.GetInfo().GetSize()), + Version: statRes.GetInfo().GetMtime().String(), + BaseFileName: path.Base(statRes.GetInfo().GetPath()), + BreadcrumbDocName: path.Base(statRes.GetInfo().GetPath()), // to get the folder we actually need to do a GetPath() request //BreadcrumbFolderName: path.Dir(statRes.Info.Path), @@ -452,20 +452,20 @@ func (f *FileConnector) CheckFileInfo(ctx context.Context) (FileInfo, error) { var isPublicShare bool = false if wopiContext.User != nil { // UserId must use only alphanumeric chars (https://learn.microsoft.com/en-us/microsoft-365/cloud-storage-partner-program/rest/files/checkfileinfo/checkfileinfo-response#requirements-for-user-identity-properties) - if wopiContext.User.Id.Type == userv1beta1.UserType_USER_TYPE_LIGHTWEIGHT { - fileInfo.UserId = hex.EncodeToString([]byte(statRes.Info.Owner.OpaqueId + "@" + statRes.Info.Owner.Idp)) + if wopiContext.User.GetId().GetType() == userv1beta1.UserType_USER_TYPE_LIGHTWEIGHT { + fileInfo.UserId = hex.EncodeToString([]byte(statRes.GetInfo().GetOwner().GetOpaqueId() + "@" + statRes.GetInfo().GetOwner().GetIdp())) } else { - fileInfo.UserId = hex.EncodeToString([]byte(wopiContext.User.Id.OpaqueId + "@" + wopiContext.User.Id.Idp)) + fileInfo.UserId = hex.EncodeToString([]byte(wopiContext.User.GetId().GetOpaqueId() + "@" + wopiContext.User.GetId().GetIdp())) } - if wopiContext.User.Opaque != nil { - if _, ok := wopiContext.User.Opaque.Map["public-share-role"]; ok { + if wopiContext.User.GetOpaque() != nil { + if _, ok := wopiContext.User.GetOpaque().GetMap()["public-share-role"]; ok { isPublicShare = true } } if !isPublicShare { - fileInfo.UserFriendlyName = wopiContext.User.Username - fileInfo.UserId = hex.EncodeToString([]byte(wopiContext.User.Id.OpaqueId + "@" + wopiContext.User.Id.Idp)) + fileInfo.UserFriendlyName = wopiContext.User.GetUsername() + fileInfo.UserId = hex.EncodeToString([]byte(wopiContext.User.GetId().GetOpaqueId() + "@" + wopiContext.User.GetId().GetIdp())) } } if wopiContext.User == nil || isPublicShare { diff --git a/services/collaboration/pkg/helpers/registration.go b/services/collaboration/pkg/helpers/registration.go index 06de9cd51c..eea4708375 100644 --- a/services/collaboration/pkg/helpers/registration.go +++ b/services/collaboration/pkg/helpers/registration.go @@ -64,8 +64,8 @@ func RegisterAppProvider( return err } - if resp.Status.Code != rpcv1beta1.Code_CODE_OK { - logger.Error().Str("status_code", resp.Status.Code.String()).Msg("AddAppProvider failed") + if resp.GetStatus().GetCode() != rpcv1beta1.Code_CODE_OK { + logger.Error().Str("status_code", resp.GetStatus().GetCode().String()).Msg("AddAppProvider failed") return errors.New("status code != CODE_OK") } diff --git a/services/collaboration/pkg/service/grpc/v0/service.go b/services/collaboration/pkg/service/grpc/v0/service.go index 038a44d142..6edee2d8ec 100644 --- a/services/collaboration/pkg/service/grpc/v0/service.go +++ b/services/collaboration/pkg/service/grpc/v0/service.go @@ -56,12 +56,12 @@ func (s *Service) OpenInApp( // get the current user var user *userv1beta1.User = nil meReq := &gatewayv1beta1.WhoAmIRequest{ - Token: req.AccessToken, + Token: req.GetAccessToken(), } meResp, err := s.gwc.WhoAmI(ctx, meReq) if err == nil { - if meResp.Status.Code == rpcv1beta1.Code_CODE_OK { - user = meResp.User + if meResp.GetStatus().GetCode() == rpcv1beta1.Code_CODE_OK { + user = meResp.GetUser() } } @@ -75,11 +75,11 @@ func (s *Service) OpenInApp( // so that all sessions on one file end on the same office server c := sha256.New() - c.Write([]byte(req.ResourceInfo.Id.StorageId + "$" + req.ResourceInfo.Id.SpaceId + "!" + req.ResourceInfo.Id.OpaqueId)) + c.Write([]byte(req.GetResourceInfo().GetId().GetStorageId() + "$" + req.GetResourceInfo().GetId().GetSpaceId() + "!" + req.GetResourceInfo().GetId().GetOpaqueId())) fileRef := hex.EncodeToString(c.Sum(nil)) // get the file extension to use the right wopi app url - fileExt := path.Ext(req.GetResourceInfo().Path) + fileExt := path.Ext(req.GetResourceInfo().GetPath()) var viewAppURL string var editAppURL string @@ -127,7 +127,7 @@ func (s *Service) OpenInApp( s.logger.Error(). Err(err). Str("FileReference", providerFileRef.String()). - Str("ViewMode", req.ViewMode.String()). + Str("ViewMode", req.GetViewMode().String()). Str("Requester", user.GetId().String()). Msg("OpenInApp: error parsing viewAppUrl") return nil, err @@ -137,23 +137,23 @@ func (s *Service) OpenInApp( s.logger.Error(). Err(err). Str("FileReference", providerFileRef.String()). - Str("ViewMode", req.ViewMode.String()). + Str("ViewMode", req.GetViewMode().String()). Str("Requester", user.GetId().String()). Msg("OpenInApp: error parsing editAppUrl") return nil, err } appURL := viewAppURL - if req.ViewMode == appproviderv1beta1.ViewMode_VIEW_MODE_READ_WRITE { + if req.GetViewMode() == appproviderv1beta1.ViewMode_VIEW_MODE_READ_WRITE { appURL = editAppURL } - cryptedReqAccessToken, err := middleware.EncryptAES([]byte(s.config.JWTSecret), req.AccessToken) + cryptedReqAccessToken, err := middleware.EncryptAES([]byte(s.config.JWTSecret), req.GetAccessToken()) if err != nil { s.logger.Error(). Err(err). Str("FileReference", providerFileRef.String()). - Str("ViewMode", req.ViewMode.String()). + Str("ViewMode", req.GetViewMode().String()). Str("Requester", user.GetId().String()). Msg("OpenInApp: error encrypting access token") return &appproviderv1beta1.OpenInAppResponse{ @@ -165,19 +165,19 @@ func (s *Service) OpenInApp( AccessToken: cryptedReqAccessToken, FileReference: providerFileRef, User: user, - ViewMode: req.ViewMode, + ViewMode: req.GetViewMode(), EditAppUrl: editAppURL, ViewAppUrl: viewAppURL, } cs3Claims := &jwt.RegisteredClaims{} cs3JWTparser := jwt.Parser{} - _, _, err = cs3JWTparser.ParseUnverified(req.AccessToken, cs3Claims) + _, _, err = cs3JWTparser.ParseUnverified(req.GetAccessToken(), cs3Claims) if err != nil { s.logger.Error(). Err(err). Str("FileReference", providerFileRef.String()). - Str("ViewMode", req.ViewMode.String()). + Str("ViewMode", req.GetViewMode().String()). Str("Requester", user.GetId().String()). Msg("OpenInApp: error parsing JWT token") return nil, err @@ -197,7 +197,7 @@ func (s *Service) OpenInApp( s.logger.Error(). Err(err). Str("FileReference", providerFileRef.String()). - Str("ViewMode", req.ViewMode.String()). + Str("ViewMode", req.GetViewMode().String()). Str("Requester", user.GetId().String()). Msg("OpenInApp: error signing access token") return &appproviderv1beta1.OpenInAppResponse{ @@ -207,7 +207,7 @@ func (s *Service) OpenInApp( s.logger.Debug(). Str("FileReference", providerFileRef.String()). - Str("ViewMode", req.ViewMode.String()). + Str("ViewMode", req.GetViewMode().String()). Str("Requester", user.GetId().String()). Msg("OpenInApp: success")