mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-20 14:00:04 +02:00
Add golangci (#6418)
This commit is contained in:
parent
5832f8d90d
commit
f9ec2f89f2
147 changed files with 1046 additions and 774 deletions
|
@ -17,7 +17,7 @@ import (
|
|||
)
|
||||
|
||||
//checkIsValidRequest check if it a valid request in case of bad request it write the response to ctx.
|
||||
func checkIsValidRequest(ctx *context.Context, post bool) bool {
|
||||
func checkIsValidRequest(ctx *context.Context) bool {
|
||||
if !setting.LFS.StartServer {
|
||||
writeStatus(ctx, 404)
|
||||
return false
|
||||
|
@ -35,13 +35,6 @@ func checkIsValidRequest(ctx *context.Context, post bool) bool {
|
|||
}
|
||||
ctx.User = user
|
||||
}
|
||||
if post {
|
||||
mediaParts := strings.Split(ctx.Req.Header.Get("Content-Type"), ";")
|
||||
if mediaParts[0] != metaMediaType {
|
||||
writeStatus(ctx, 400)
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -71,7 +64,7 @@ func handleLockListOut(ctx *context.Context, repo *models.Repository, lock *mode
|
|||
|
||||
// GetListLockHandler list locks
|
||||
func GetListLockHandler(ctx *context.Context) {
|
||||
if !checkIsValidRequest(ctx, false) {
|
||||
if !checkIsValidRequest(ctx) {
|
||||
return
|
||||
}
|
||||
ctx.Resp.Header().Set("Content-Type", metaMediaType)
|
||||
|
@ -135,7 +128,7 @@ func GetListLockHandler(ctx *context.Context) {
|
|||
|
||||
// PostLockHandler create lock
|
||||
func PostLockHandler(ctx *context.Context) {
|
||||
if !checkIsValidRequest(ctx, false) {
|
||||
if !checkIsValidRequest(ctx) {
|
||||
return
|
||||
}
|
||||
ctx.Resp.Header().Set("Content-Type", metaMediaType)
|
||||
|
@ -198,7 +191,7 @@ func PostLockHandler(ctx *context.Context) {
|
|||
|
||||
// VerifyLockHandler list locks for verification
|
||||
func VerifyLockHandler(ctx *context.Context) {
|
||||
if !checkIsValidRequest(ctx, false) {
|
||||
if !checkIsValidRequest(ctx) {
|
||||
return
|
||||
}
|
||||
ctx.Resp.Header().Set("Content-Type", metaMediaType)
|
||||
|
@ -249,7 +242,7 @@ func VerifyLockHandler(ctx *context.Context) {
|
|||
|
||||
// UnLockHandler delete locks
|
||||
func UnLockHandler(ctx *context.Context) {
|
||||
if !checkIsValidRequest(ctx, false) {
|
||||
if !checkIsValidRequest(ctx) {
|
||||
return
|
||||
}
|
||||
ctx.Resp.Header().Set("Content-Type", metaMediaType)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue