From ab88cef1f3f341380da41999b02789e8c4093b62 Mon Sep 17 00:00:00 2001
From: Gianmaria Del Monte <g.macmount@gmail.com>
Date: Mon, 13 Nov 2023 17:13:08 +0100
Subject: [PATCH] fix path

---
 internal/http/services/owncloud/ocdav/propfind.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/internal/http/services/owncloud/ocdav/propfind.go b/internal/http/services/owncloud/ocdav/propfind.go
index 14435a8c5a..c6e1ca2f04 100644
--- a/internal/http/services/owncloud/ocdav/propfind.go
+++ b/internal/http/services/owncloud/ocdav/propfind.go
@@ -533,7 +533,6 @@ func spaceHref(ctx context.Context, baseURI, fullPath string) string {
 // prefixing it with the baseURI.
 func (s *svc) mdToPropResponse(ctx context.Context, pf *propfindXML, md *provider.ResourceInfo, ns string, usershares, linkshares map[string]struct{}) (*responseXML, error) {
 	sublog := appctx.GetLogger(ctx).With().Str("ns", ns).Logger()
-	md.Path = strings.TrimPrefix(md.Path, ns)
 
 	baseURI := ctx.Value(ctxKeyBaseURI).(string)
 
@@ -543,6 +542,7 @@ func (s *svc) mdToPropResponse(ctx context.Context, pf *propfindXML, md *provide
 	if _, ok := ctx.Value(ctxSpaceID).(string); ok {
 		ref = spaceHref(ctx, baseURI, md.Path)
 	} else {
+		md.Path = strings.TrimPrefix(md.Path, ns)
 		ref = path.Join(baseURI, md.Path)
 	}
 	if md.Type == provider.ResourceType_RESOURCE_TYPE_CONTAINER {