Skip to content

Commit c620c0c

Browse files
authored
Merge pull request #11687 from owncloud/feat/drop-remote-php
[full-ci] feat: [OCISDEV-330] drop remote.php prefix
2 parents df53c72 + 1b83d98 commit c620c0c

File tree

5 files changed

+15
-4
lines changed

5 files changed

+15
-4
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Enhancement: Drop remote.php prefix
2+
3+
The `remote.php` prefix is now fully optional in WebDAV endpoints and is never returned in responses.
4+
5+
https://github.com/owncloud/ocis/pull/11687

services/frontend/pkg/revaconfig/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ func FrontendConfigFromStruct(cfg *config.Config, logger log.Logger) (map[string
201201
"capabilities": map[string]interface{}{
202202
"core": map[string]interface{}{
203203
"poll_interval": 60,
204-
"webdav_root": "remote.php/webdav",
204+
"webdav_root": "webdav",
205205
"status": map[string]interface{}{
206206
"installed": true,
207207
"maintenance": false,

services/proxy/pkg/config/defaults/defaultconfig.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ func DefaultPolicies() []config.Policy {
188188
Endpoint: "/remote.php/?preview=1",
189189
Service: "com.owncloud.web.webdav",
190190
},
191+
{
192+
Type: config.QueryRoute,
193+
Endpoint: "/?preview=1",
194+
Service: "com.owncloud.web.webdav",
195+
},
191196
// TODO the actual REPORT goes to /dav/files/{username}, which is user specific ... how would this work in a spaces world?
192197
// TODO what paths are returned? the href contains the full path so it should be possible to return urls from other spaces?
193198
// TODO or we allow a REPORT on /dav/spaces to search all spaces and /dav/space/{spaceid} to search a specific space

services/proxy/pkg/middleware/policies.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,16 @@ func Policies(qs string, opts ...Option) func(next http.Handler) http.Handler {
7979
// this should only be used as last bastion, every request goes through the proxy and doing stats is expensive!
8080
// needed for:
8181
// - if a single resource is shared -> the url only contains the resourceID (spaceRef)
82-
if resource.Name == "" && filepath.Ext(r.URL.Path) == "" && r.Method == http.MethodPut && strings.HasPrefix(r.URL.Path, "/remote.php/dav/spaces") {
82+
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")) {
8383
client, err := gatewaySelector.Next()
8484
if err != nil {
8585
logger.Err(err).Msg("error selecting next gateway client")
8686
RenderError(w, r, req, http.StatusForbidden, DeniedMessage)
8787
return
8888
}
8989

90-
resourceID, err := storagespace.ParseID(strings.TrimPrefix(r.URL.Path, "/remote.php/dav/spaces/"))
90+
path := strings.TrimPrefix(r.URL.Path, "/remote.php")
91+
resourceID, err := storagespace.ParseID(strings.TrimPrefix(path, "/dav/spaces/"))
9192
if err != nil {
9293
logger.Debug().Err(err).Msg("error parsing the resourceId")
9394
RenderError(w, r, req, http.StatusForbidden, DeniedMessage)

tests/acceptance/features/coreApiCapabilities/capabilitiesWithNormalUser.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Feature: default capabilities for normal user
4040
"const": 60
4141
},
4242
"webdav-root": {
43-
"const": "remote.php/webdav"
43+
"const": "webdav"
4444
},
4545
"status": {
4646
"type": "object",

0 commit comments

Comments
 (0)