From 1b83d986f90a04cb185ced599caa2e51390a1e18 Mon Sep 17 00:00:00 2001 From: Lukas Hirt Date: Wed, 24 Sep 2025 10:32:37 +0200 Subject: [PATCH] feat: [OCISDEV-330] drop remote.php prefix The `remote.php` prefix is now fully optional in WebDAV endpoints and is never returned in responses. --- changelog/unreleased/enhancement-drop-remote-php.md | 5 +++++ services/frontend/pkg/revaconfig/config.go | 2 +- services/proxy/pkg/config/defaults/defaultconfig.go | 5 +++++ services/proxy/pkg/middleware/policies.go | 5 +++-- .../coreApiCapabilities/capabilitiesWithNormalUser.feature | 2 +- 5 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 changelog/unreleased/enhancement-drop-remote-php.md diff --git a/changelog/unreleased/enhancement-drop-remote-php.md b/changelog/unreleased/enhancement-drop-remote-php.md new file mode 100644 index 00000000000..bcc8254f4e6 --- /dev/null +++ b/changelog/unreleased/enhancement-drop-remote-php.md @@ -0,0 +1,5 @@ +Enhancement: Drop remote.php prefix + +The `remote.php` prefix is now fully optional in WebDAV endpoints and is never returned in responses. + +https://github.com/owncloud/ocis/pull/11687 diff --git a/services/frontend/pkg/revaconfig/config.go b/services/frontend/pkg/revaconfig/config.go index 0e002605bfe..54cb921ff73 100644 --- a/services/frontend/pkg/revaconfig/config.go +++ b/services/frontend/pkg/revaconfig/config.go @@ -201,7 +201,7 @@ func FrontendConfigFromStruct(cfg *config.Config, logger log.Logger) (map[string "capabilities": map[string]interface{}{ "core": map[string]interface{}{ "poll_interval": 60, - "webdav_root": "remote.php/webdav", + "webdav_root": "webdav", "status": map[string]interface{}{ "installed": true, "maintenance": false, diff --git a/services/proxy/pkg/config/defaults/defaultconfig.go b/services/proxy/pkg/config/defaults/defaultconfig.go index 01c23b0855e..846161ed117 100644 --- a/services/proxy/pkg/config/defaults/defaultconfig.go +++ b/services/proxy/pkg/config/defaults/defaultconfig.go @@ -185,6 +185,11 @@ func DefaultPolicies() []config.Policy { Endpoint: "/remote.php/?preview=1", Service: "com.owncloud.web.webdav", }, + { + Type: config.QueryRoute, + Endpoint: "/?preview=1", + Service: "com.owncloud.web.webdav", + }, // TODO the actual REPORT goes to /dav/files/{username}, which is user specific ... how would this work in a spaces world? // TODO what paths are returned? the href contains the full path so it should be possible to return urls from other spaces? // TODO or we allow a REPORT on /dav/spaces to search all spaces and /dav/space/{spaceid} to search a specific space diff --git a/services/proxy/pkg/middleware/policies.go b/services/proxy/pkg/middleware/policies.go index 32fb92408df..e8022f5c118 100644 --- a/services/proxy/pkg/middleware/policies.go +++ b/services/proxy/pkg/middleware/policies.go @@ -79,7 +79,7 @@ func Policies(qs string, opts ...Option) func(next http.Handler) http.Handler { // this should only be used as last bastion, every request goes through the proxy and doing stats is expensive! // needed for: // - if a single resource is shared -> the url only contains the resourceID (spaceRef) - if resource.Name == "" && filepath.Ext(r.URL.Path) == "" && r.Method == http.MethodPut && strings.HasPrefix(r.URL.Path, "/remote.php/dav/spaces") { + if resource.Name == "" && filepath.Ext(r.URL.Path) == "" && r.Method == http.MethodPut && (strings.HasPrefix(r.URL.Path, "/remote.php/dav/spaces") || strings.HasPrefix(r.URL.Path, "/dav/spaces")) { client, err := gatewaySelector.Next() if err != nil { logger.Err(err).Msg("error selecting next gateway client") @@ -87,7 +87,8 @@ func Policies(qs string, opts ...Option) func(next http.Handler) http.Handler { return } - resourceID, err := storagespace.ParseID(strings.TrimPrefix(r.URL.Path, "/remote.php/dav/spaces/")) + path := strings.TrimPrefix(r.URL.Path, "/remote.php") + resourceID, err := storagespace.ParseID(strings.TrimPrefix(path, "/dav/spaces/")) if err != nil { logger.Debug().Err(err).Msg("error parsing the resourceId") RenderError(w, r, req, http.StatusForbidden, DeniedMessage) diff --git a/tests/acceptance/features/coreApiCapabilities/capabilitiesWithNormalUser.feature b/tests/acceptance/features/coreApiCapabilities/capabilitiesWithNormalUser.feature index e387b207094..e013293aebb 100644 --- a/tests/acceptance/features/coreApiCapabilities/capabilitiesWithNormalUser.feature +++ b/tests/acceptance/features/coreApiCapabilities/capabilitiesWithNormalUser.feature @@ -40,7 +40,7 @@ Feature: default capabilities for normal user "const": 60 }, "webdav-root": { - "const": "remote.php/webdav" + "const": "webdav" }, "status": { "type": "object",