Skip to content

Commit f3fe4de

Browse files
committed
Moved checks into router.
1 parent dad7521 commit f3fe4de

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

routers/routes/web.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ func RegisterRoutes(m *web.Route) {
11131113
m.Post("/", lfs.PostLockHandler)
11141114
m.Post("/verify", lfs.VerifyLockHandler)
11151115
m.Post("/{lid}/unlock", lfs.UnLockHandler)
1116-
})
1116+
}, lfs.CheckAcceptMediaType)
11171117
m.Any("/*", func(ctx *context.Context) {
11181118
ctx.NotFound("", nil)
11191119
})

services/lfs/locks.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,6 @@ import (
2121

2222
//checkIsValidRequest check if it a valid request in case of bad request it write the response to ctx.
2323
func checkIsValidRequest(ctx *context.Context) bool {
24-
if !setting.LFS.StartServer {
25-
log.Debug("Attempt to access LFS server but LFS server is disabled")
26-
writeStatus(ctx, http.StatusNotFound)
27-
return false
28-
}
29-
if !isValidAccept(ctx.Req) {
30-
log.Info("Attempt access LOCKs without accepting the correct media type: %s", lfs_module.MediaType)
31-
writeStatus(ctx, http.StatusBadRequest)
32-
return false
33-
}
3424
if !ctx.IsSigned {
3525
user, _, _, err := parseToken(ctx.Req.Header.Get("Authorization"))
3626
if err != nil {

0 commit comments

Comments
 (0)