Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove OCDAV options namespace parameter #2180

Merged
merged 1 commit into from
Oct 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/unreleased/ocdav-remove-options-namespace.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Remove OCDAV options namespace parameter

We dropped the namespace parameter, as it is not used in the options handler.

https://github.com/cs3org/reva/pull/2180
2 changes: 1 addition & 1 deletion internal/http/services/owncloud/ocdav/avatars.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (h *AvatarsHandler) Handler(s *svc) http.Handler {
// no need for the user, and we need to be able
// to answer preflight checks, which have no auth headers
r.URL.Path = "/" // always use / ... we just want the options answered so phoenix doesnt hiccup
s.handleOptions(w, r, "avatars")
s.handleOptions(w, r)
return
}

Expand Down
2 changes: 1 addition & 1 deletion internal/http/services/owncloud/ocdav/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"strings"
)

func (s *svc) handleOptions(w http.ResponseWriter, r *http.Request, ns string) {
func (s *svc) handleOptions(w http.ResponseWriter, r *http.Request) {
allow := "OPTIONS, LOCK, GET, HEAD, POST, DELETE, PROPPATCH, COPY,"
allow += " MOVE, UNLOCK, PROPFIND, MKCOL, REPORT, SEARCH,"
allow += " PUT" // TODO(jfd): only for files ... but we cannot create the full path without a user ... which we only have when credentials are sent
Expand Down
4 changes: 2 additions & 2 deletions internal/http/services/owncloud/ocdav/publicfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (h *PublicFileHandler) Handler(s *svc) http.Handler {
case http.MethodGet:
s.handlePathGet(w, r, h.namespace)
case http.MethodOptions:
s.handleOptions(w, r, h.namespace)
s.handleOptions(w, r)
case http.MethodHead:
s.handlePathHead(w, r, h.namespace)
case http.MethodPut:
Expand All @@ -76,7 +76,7 @@ func (h *PublicFileHandler) Handler(s *svc) http.Handler {
case MethodPropfind:
s.handlePropfindOnToken(w, r, h.namespace, true)
case http.MethodOptions:
s.handleOptions(w, r, h.namespace)
s.handleOptions(w, r)
case http.MethodHead:
s.handlePathHead(w, r, h.namespace)
default:
Expand Down
4 changes: 2 additions & 2 deletions internal/http/services/owncloud/ocdav/spaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (h *SpacesHandler) Handler(s *svc) http.Handler {
// log := appctx.GetLogger(ctx)

if r.Method == http.MethodOptions {
s.handleOptions(w, r, "spaces")
s.handleOptions(w, r)
return
}

Expand Down Expand Up @@ -83,7 +83,7 @@ func (h *SpacesHandler) Handler(s *svc) http.Handler {
case http.MethodPost:
s.handleSpacesTusPost(w, r, spaceID)
case http.MethodOptions:
s.handleOptions(w, r, spaceID)
s.handleOptions(w, r)
case http.MethodHead:
s.handleSpacesHead(w, r, spaceID)
case http.MethodDelete:
Expand Down
2 changes: 1 addition & 1 deletion internal/http/services/owncloud/ocdav/trashbin.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (h *TrashbinHandler) Handler(s *svc) http.Handler {
log := appctx.GetLogger(ctx)

if r.Method == http.MethodOptions {
s.handleOptions(w, r, "trashbin")
s.handleOptions(w, r)
return
}

Expand Down
2 changes: 1 addition & 1 deletion internal/http/services/owncloud/ocdav/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (h *VersionsHandler) Handler(s *svc, rid *provider.ResourceId) http.Handler
var key string
key, r.URL.Path = router.ShiftPath(r.URL.Path)
if r.Method == http.MethodOptions {
s.handleOptions(w, r, "versions")
s.handleOptions(w, r)
return
}
if key == "" && r.Method == MethodPropfind {
Expand Down
2 changes: 1 addition & 1 deletion internal/http/services/owncloud/ocdav/webdav.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (h *WebDavHandler) Handler(s *svc) http.Handler {
case http.MethodPost:
s.handlePathTusPost(w, r, ns)
case http.MethodOptions:
s.handleOptions(w, r, ns)
s.handleOptions(w, r)
case http.MethodHead:
s.handlePathHead(w, r, ns)
case http.MethodDelete:
Expand Down