Remove invalid offset error

This commit is contained in:
Melon 2024-07-25 22:15:37 +01:00
parent 60e6d7e80b
commit 0d49ed512a
Signed by: melon
GPG Key ID: 6C9D970C50D26A25
2 changed files with 2 additions and 18 deletions

View File

@ -12,16 +12,8 @@ import (
) )
func (h *HttpServer) ManageAppsGet(rw http.ResponseWriter, req *http.Request, _ httprouter.Params, auth UserAuth) { func (h *HttpServer) ManageAppsGet(rw http.ResponseWriter, req *http.Request, _ httprouter.Params, auth UserAuth) {
offset := 0
q := req.URL.Query() q := req.URL.Query()
if q.Has("offset") { offset, _ := strconv.Atoi(q.Get("offset"))
var err error
offset, err = strconv.Atoi(q.Get("offset"))
if err != nil {
http.Error(rw, "400 Bad Request: Invalid offset", http.StatusBadRequest)
return
}
}
var roles string var roles string
var appList []database.GetAppListRow var appList []database.GetAppListRow

View File

@ -10,16 +10,8 @@ import (
) )
func (h *HttpServer) ManageUsersGet(rw http.ResponseWriter, req *http.Request, _ httprouter.Params, auth UserAuth) { func (h *HttpServer) ManageUsersGet(rw http.ResponseWriter, req *http.Request, _ httprouter.Params, auth UserAuth) {
offset := 0
q := req.URL.Query() q := req.URL.Query()
if q.Has("offset") { offset, _ := strconv.Atoi(q.Get("offset"))
var err error
offset, err = strconv.Atoi(q.Get("offset"))
if err != nil {
http.Error(rw, "400 Bad Request: Invalid offset", http.StatusBadRequest)
return
}
}
var roles string var roles string
var userList []database.GetUserListRow var userList []database.GetUserListRow