From fb43919e0aa1b3568b377fe22ee29029030606ad Mon Sep 17 00:00:00 2001 From: Roman Perekhod Date: Thu, 9 May 2024 23:12:20 +0200 Subject: [PATCH] fixed OpenInApp URL --- .../collaboration/pkg/service/grpc/v0/service.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/services/collaboration/pkg/service/grpc/v0/service.go b/services/collaboration/pkg/service/grpc/v0/service.go index 28d27b47f..cbdb603ff 100644 --- a/services/collaboration/pkg/service/grpc/v0/service.go +++ b/services/collaboration/pkg/service/grpc/v0/service.go @@ -4,6 +4,7 @@ import ( "context" "crypto/sha256" "encoding/hex" + "fmt" "net/url" "path" "strconv" @@ -99,6 +100,15 @@ func (s *Service) OpenInApp( editAppURL = url } } + if editAppURL == "" && viewAppURL == "" { + err := fmt.Errorf("OpenInApp: neither edit nor view app url found") + s.logger.Error(). + Err(err). + Str("FileReference", providerFileRef.String()). + Str("ViewMode", req.GetViewMode().String()). + Str("Requester", user.GetId().String()).Send() + return nil, err + } if editAppURL == "" { // assuming that an view action is always available in the /hosting/discovery manifest @@ -107,6 +117,10 @@ func (s *Service) OpenInApp( // there is no known case of supporting edit only without view editAppURL = viewAppURL } + if viewAppURL == "" { + // the URL of the end-user application in view mode when different (defaults to edit mod URL) + viewAppURL = editAppURL + } wopiSrcURL := url.URL{ Scheme: s.config.HTTP.Scheme,