diff --git a/api/database/mysql/mysql.go b/api/database/mysql/mysql.go index dd29a8718..287a2843f 100644 --- a/api/database/mysql/mysql.go +++ b/api/database/mysql/mysql.go @@ -193,7 +193,7 @@ func (m *MySQL) Dump(path, filename string) error { return &errors.Error{Code: errors.INVALID, Message: "Error writing SQL to file with the path: " + p, Operation: op, Err: err} } - err = ioutil.WriteFile(p, bytes, 0644) + err = ioutil.WriteFile(p, bytes, os.ModePerm) if err != nil { return &errors.Error{Code: errors.INVALID, Message: "No file or directory with the path: " + p, Operation: op, Err: err} } diff --git a/api/http/handler/api/auth/login.go b/api/http/handler/api/auth/login.go index 1c805a680..4de862a35 100644 --- a/api/http/handler/api/auth/login.go +++ b/api/http/handler/api/auth/login.go @@ -45,7 +45,7 @@ func (a *Auth) Login(ctx *gin.Context) { user.HidePassword() - ctx.SetCookie("verbis-session", user.Token, 172800, "/", "", false, true) + ctx.SetCookie("verbis-session", user.Token, 172800, "/", "", false, true) //nolint api.Respond(ctx, http.StatusOK, "Successfully logged in & session started", user) } diff --git a/api/http/handler/api/redirects/update.go b/api/http/handler/api/redirects/update.go index 728581f79..8db30d139 100644 --- a/api/http/handler/api/redirects/update.go +++ b/api/http/handler/api/redirects/update.go @@ -28,7 +28,7 @@ func (r *Redirects) Update(ctx *gin.Context) { return } - id, err := strconv.ParseInt(ctx.Param("id"), 10, 64) + id, err := strconv.ParseInt(ctx.Param("id"), 10, 64) //nolint if err != nil { api.Respond(ctx, http.StatusBadRequest, "A valid ID is required to update the redirect", &errors.Error{Code: errors.INVALID, Err: err, Operation: op}) return diff --git a/api/http/middleware/tokencheck.go b/api/http/middleware/tokencheck.go index 76f0917d4..727278e3d 100644 --- a/api/http/middleware/tokencheck.go +++ b/api/http/middleware/tokencheck.go @@ -29,7 +29,7 @@ func AdminTokenCheck(d *deps.Deps) gin.HandlerFunc { if u.Role.Id > 1 { g.Next() } else { - api.AbortJSON(g, 403, "You must have access level of administrator to access this endpoint.", nil) + api.AbortJSON(g, http.StatusForbidden, "You must have access level of administrator to access this endpoint.", nil) return } } @@ -50,7 +50,7 @@ func OperatorTokenCheck(d *deps.Deps) gin.HandlerFunc { if u.Role.Id > 0 { g.Next() } else { - api.AbortJSON(g, 403, "You must have access level of operator to access this endpoint.", nil) + api.AbortJSON(g, http.StatusForbidden, "You must have access level of operator to access this endpoint.", nil) return } } @@ -94,7 +94,7 @@ func checkUserToken(d *deps.Deps, g *gin.Context) (*domain.User, error) { } if u.Role.Id == domain.BannedRoleID { - api.AbortJSON(g, 403, "Your account has been suspended by the administration team", nil) + api.AbortJSON(g, http.StatusForbidden, "Your account has been suspended by the administration team", nil) return &domain.User{}, err } diff --git a/api/publisher/headers.go b/api/publisher/headers.go index e7f6025f3..920daba9c 100644 --- a/api/publisher/headers.go +++ b/api/publisher/headers.go @@ -66,7 +66,7 @@ func (c *headers) Cache(g *gin.Context) { if extension == "."+v { cache := "" if request == "max-age" || request == "min-fresh" || request == "max-stale" { - cache = fmt.Sprintf("%s=%s, %s", request, strconv.FormatInt(expiration, 10), "public") + cache = fmt.Sprintf("%s=%s, %s", request, strconv.FormatInt(expiration, 10), "public") //nolint } else { cache = request }