Merge pull request #9112 from 2403905/collaboration-registration-fix

fixed the collaboration service GRPC namespace
This commit is contained in:
Roman Perekhod
2024-05-10 09:29:58 +02:00
committed by GitHub
4 changed files with 22 additions and 4 deletions
@@ -0,0 +1,5 @@
Bugfix: Fix collaboration registry setting
Fixed the collaboration service GRPC namespace
https://github.com/owncloud/ocis/pull/9105
@@ -18,7 +18,7 @@ import (
// There are no explicit requirements for the context, and it will be passed
// without changes to the underlying RegisterService method.
func RegisterOcisService(ctx context.Context, cfg *config.Config, logger log.Logger) error {
svc := registry.BuildGRPCService(cfg.Service.Name, uuid.Must(uuid.NewV4()).String(), cfg.GRPC.Addr, "0.0.0")
svc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, uuid.Must(uuid.NewV4()).String(), cfg.GRPC.Addr, "0.0.0")
return registry.RegisterService(ctx, svc, logger)
}
@@ -61,7 +61,7 @@ func RegisterAppProvider(
Name: cfg.App.Name,
Description: cfg.App.Description,
Icon: cfg.App.Icon,
Address: cfg.Service.Name,
Address: cfg.GRPC.Namespace + "." + cfg.Service.Name,
MimeTypes: mimeTypes,
},
}
@@ -2,7 +2,6 @@ package http
import (
"fmt"
stdhttp "net/http"
"github.com/go-chi/chi/v5"
@@ -26,7 +25,7 @@ func Server(opts ...Option) (http.Service, error) {
http.TLSConfig(options.Config.HTTP.TLS),
http.Logger(options.Logger),
http.Namespace(options.Config.HTTP.Namespace),
http.Name(options.Config.Service.Name),
http.Name("wopi"),
http.Version(version.GetString()),
http.Address(options.Config.HTTP.BindAddr),
http.Context(options.Context),
@@ -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,