diff --git a/internal/http/services/owncloud/ocdav/errors/error.go b/internal/http/services/owncloud/ocdav/errors/error.go index 420a2b02955..a699170dd94 100644 --- a/internal/http/services/owncloud/ocdav/errors/error.go +++ b/internal/http/services/owncloud/ocdav/errors/error.go @@ -30,14 +30,14 @@ import ( var sabreException = map[int]string{ - //http.StatusMultipleChoices: "Multiple Choices", - //http.StatusMovedPermanently: "Moved Permanently", - //http.StatusFound: "Found", - //http.StatusSeeOther: "See Other", - //http.StatusNotModified: "Not Modified", - //http.StatusUseProxy: "Use Proxy", - //http.StatusTemporaryRedirect: "Temporary Redirect", - //http.StatusPermanentRedirect: "Permanent Redirect", + // http.StatusMultipleChoices: "Multiple Choices", + // http.StatusMovedPermanently: "Moved Permanently", + // http.StatusFound: "Found", + // http.StatusSeeOther: "See Other", + // http.StatusNotModified: "Not Modified", + // http.StatusUseProxy: "Use Proxy", + // http.StatusTemporaryRedirect: "Temporary Redirect", + // http.StatusPermanentRedirect: "Permanent Redirect", http.StatusBadRequest: "Sabre\\DAV\\Exception\\BadRequest", http.StatusUnauthorized: "Sabre\\DAV\\Exception\\NotAuthenticated", @@ -45,41 +45,41 @@ var sabreException = map[int]string{ http.StatusForbidden: "Sabre\\DAV\\Exception\\Forbidden", // InvalidResourceType, InvalidSyncToken, TooManyMatches http.StatusNotFound: "Sabre\\DAV\\Exception\\NotFound", http.StatusMethodNotAllowed: "Sabre\\DAV\\Exception\\MethodNotAllowed", - //http.StatusNotAcceptable: "Not Acceptable", - //http.StatusProxyAuthRequired: "Proxy Authentication Required", - //http.StatusRequestTimeout: "Request Timeout", + // http.StatusNotAcceptable: "Not Acceptable", + // http.StatusProxyAuthRequired: "Proxy Authentication Required", + // http.StatusRequestTimeout: "Request Timeout", http.StatusConflict: "Sabre\\DAV\\Exception\\Conflict", // LockTokenMatchesRequestUri - //http.StatusGone: "Gone", + // http.StatusGone: "Gone", http.StatusLengthRequired: "Sabre\\DAV\\Exception\\LengthRequired", http.StatusPreconditionFailed: "Sabre\\DAV\\Exception\\PreconditionFailed", - //http.StatusRequestEntityTooLarge: "Request Entity Too Large", - //http.StatusRequestURITooLong: "Request URI Too Long", + // http.StatusRequestEntityTooLarge: "Request Entity Too Large", + // http.StatusRequestURITooLong: "Request URI Too Long", http.StatusUnsupportedMediaType: "Sabre\\DAV\\Exception\\UnsupportedMediaType", // ReportNotSupported http.StatusRequestedRangeNotSatisfiable: "Sabre\\DAV\\Exception\\RequestedRangeNotSatisfiable", - //http.StatusExpectationFailed: "Expectation Failed", - //http.StatusTeapot: "I'm a teapot", - //http.StatusMisdirectedRequest: "Misdirected Request", - //http.StatusUnprocessableEntity: "Unprocessable Entity", + // http.StatusExpectationFailed: "Expectation Failed", + // http.StatusTeapot: "I'm a teapot", + // http.StatusMisdirectedRequest: "Misdirected Request", + // http.StatusUnprocessableEntity: "Unprocessable Entity", http.StatusLocked: "Sabre\\DAV\\Exception\\Locked", // ConflictingLock - //http.StatusFailedDependency: "Failed Dependency", - //http.StatusTooEarly: "Too Early", - //http.StatusUpgradeRequired: "Upgrade Required", - //http.StatusPreconditionRequired: "Precondition Required", - //http.StatusTooManyRequests: "Too Many Requests", - //http.StatusRequestHeaderFieldsTooLarge: "Request Header Fields Too Large", - //http.StatusUnavailableForLegalReasons: "Unavailable For Legal Reasons", + // http.StatusFailedDependency: "Failed Dependency", + // http.StatusTooEarly: "Too Early", + // http.StatusUpgradeRequired: "Upgrade Required", + // http.StatusPreconditionRequired: "Precondition Required", + // http.StatusTooManyRequests: "Too Many Requests", + // http.StatusRequestHeaderFieldsTooLarge: "Request Header Fields Too Large", + // http.StatusUnavailableForLegalReasons: "Unavailable For Legal Reasons", - //http.StatusInternalServerError: "Internal Server Error", + // http.StatusInternalServerError: "Internal Server Error", http.StatusNotImplemented: "Sabre\\DAV\\Exception\\NotImplemented", - //http.StatusBadGateway: "Bad Gateway", + // http.StatusBadGateway: "Bad Gateway", http.StatusServiceUnavailable: "Sabre\\DAV\\Exception\\ServiceUnavailable", - //http.StatusGatewayTimeout: "Gateway Timeout", - //http.StatusHTTPVersionNotSupported: "HTTP Version Not Supported", - //http.StatusVariantAlsoNegotiates: "Variant Also Negotiates", + // http.StatusGatewayTimeout: "Gateway Timeout", + // http.StatusHTTPVersionNotSupported: "HTTP Version Not Supported", + // http.StatusVariantAlsoNegotiates: "Variant Also Negotiates", http.StatusInsufficientStorage: "Sabre\\DAV\\Exception\\InsufficientStorage", - //http.StatusLoopDetected: "Loop Detected", - //http.StatusNotExtended: "Not Extended", - //http.StatusNetworkAuthenticationRequired: "Network Authentication Required", + // http.StatusLoopDetected: "Loop Detected", + // http.StatusNotExtended: "Not Extended", + // http.StatusNetworkAuthenticationRequired: "Network Authentication Required", } // SabreException returns a sabre exception text for the HTTP status code. It returns the empty diff --git a/internal/http/services/owncloud/ocdav/webdav.go b/internal/http/services/owncloud/ocdav/webdav.go index 9f74db19926..81260815102 100644 --- a/internal/http/services/owncloud/ocdav/webdav.go +++ b/internal/http/services/owncloud/ocdav/webdav.go @@ -75,7 +75,8 @@ func (h *WebDavHandler) Handler(s *svc) http.Handler { p.HandlePathPropfind(w, r, ns) case MethodLock: log := appctx.GetLogger(r.Context()) - status, err := http.StatusBadRequest, errors.ErrUnsupportedMethod + status := http.StatusBadRequest + // TODO initialize err with errors.ErrUnsupportedMethod status, err = s.handleLock(w, r, ns) if status != 0 { // 0 would mean handleLock already sent the response w.WriteHeader(status) diff --git a/pkg/errtypes/errtypes.go b/pkg/errtypes/errtypes.go index e50c4070d97..d580d33d3b2 100644 --- a/pkg/errtypes/errtypes.go +++ b/pkg/errtypes/errtypes.go @@ -229,7 +229,7 @@ func NewErrtypeFromStatus(status *rpc.Status) error { case rpc.Code_CODE_PERMISSION_DENIED: return PermissionDenied(status.Message) // FIXME add locked status? - //case rpc.Code_CODE_LOCKED: + // case rpc.Code_CODE_LOCKED: // return Locked(status.Message) // case rpc.Code_CODE_DATA_LOSS: ? // IsPartialContent