mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-09-19 23:46:59 +00:00
Various fixes and improvements (#1643)
- allow repo names to be case-insensitive - improve backend error handling on DB get errors (record not found -> 404, else -> 500) - replace magic numbers of http response codes - unify the look and feel of cancel / save buttons on forms and view them in one line --------- Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
@@ -15,11 +15,13 @@
|
||||
package session
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/woodpecker-ci/woodpecker/server/store/types"
|
||||
|
||||
"github.com/woodpecker-ci/woodpecker/server"
|
||||
"github.com/woodpecker-ci/woodpecker/server/model"
|
||||
@@ -62,7 +64,11 @@ func SetRepo() gin.HandlerFunc {
|
||||
)
|
||||
|
||||
if user != nil {
|
||||
c.AbortWithStatus(http.StatusNotFound)
|
||||
if errors.Is(err, types.RecordNotExist) {
|
||||
c.AbortWithStatus(http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
_ = c.AbortWithError(http.StatusInternalServerError, err)
|
||||
} else {
|
||||
c.AbortWithStatus(http.StatusUnauthorized)
|
||||
}
|
||||
|
Reference in New Issue
Block a user