From 85c1130de0e4bae65c8a06d4e775ebb7bce0f480 Mon Sep 17 00:00:00 2001 From: Giuseppe Lo Presti Date: Fri, 24 Feb 2023 15:57:28 +0100 Subject: [PATCH] Fixed public link paths in wopi driver following frontend updates --- pkg/app/provider/wopi/wopi.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/app/provider/wopi/wopi.go b/pkg/app/provider/wopi/wopi.go index 2c4b0defe5c..b602580a793 100644 --- a/pkg/app/provider/wopi/wopi.go +++ b/pkg/app/provider/wopi/wopi.go @@ -56,6 +56,8 @@ import ( "github.com/pkg/errors" ) +const publicLinkUrlPrefix = "/files/link/public/" + func init() { registry.Register("wopi", New) } @@ -166,7 +168,7 @@ func (p *wopiProvider) GetAppURL(ctx context.Context, resource *provider.Resourc // TODO (lopresti) consolidate with the templating implemented in the edge branch; // here we assume the FolderBaseURL looks like `https://` and we - // either append `/files/spaces/` or `/s//` + // either append `/files/spaces/` or publicLinkUrlPrefix + `/` var rPath string if _, ok := utils.HasPublicShareRole(u); ok { // we are in a public link @@ -494,7 +496,7 @@ func getPathForPublicLink(ctx context.Context, scopes map[string]*authpb.Scope, if statRes.Info.Path == resource.Path { // this is a direct link to the resource - return "/s/" + pubShares[0].Token, nil + return publicLinkUrlPrefix + pubShares[0].Token, nil } // otherwise we are in a subfolder of the public link relPath, err := filepath.Rel(statRes.Info.Path, resource.Path) @@ -504,5 +506,5 @@ func getPathForPublicLink(ctx context.Context, scopes map[string]*authpb.Scope, if strings.HasPrefix(relPath, "../") { return "", errors.New("Scope path does not contain target resource") } - return path.Join("/files/public/show/"+pubShares[0].Token, path.Dir(relPath)), nil + return path.Join(publicLinkUrlPrefix+pubShares[0].Token, path.Dir(relPath)), nil }