Skip to content

Commit

Permalink
fix a few linter items
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
  • Loading branch information
butonic committed Jan 28, 2022
1 parent 8b2d31c commit 5be9c26
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 35 deletions.
66 changes: 33 additions & 33 deletions internal/http/services/owncloud/ocdav/errors/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,56 +30,56 @@ 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",
http.StatusPaymentRequired: "Sabre\\DAV\\Exception\\PaymentRequired",
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
Expand Down
3 changes: 2 additions & 1 deletion internal/http/services/owncloud/ocdav/webdav.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/errtypes/errtypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5be9c26

Please sign in to comment.