mirror of
https://github.com/go-gitea/gitea
synced 2025-07-10 04:27:22 +00:00
Validate hex colors when creating/editing labels (#34623)
Resolves #34618. --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@ -17,6 +17,7 @@ import (
|
||||
|
||||
// RedirectURL returns the redirect URL of a http response.
|
||||
// It also works for JSONRedirect: `{"redirect": "..."}`
|
||||
// FIXME: it should separate the logic of checking from header and JSON body
|
||||
func RedirectURL(resp http.ResponseWriter) string {
|
||||
loc := resp.Header().Get("Location")
|
||||
if loc != "" {
|
||||
@ -34,6 +35,15 @@ func RedirectURL(resp http.ResponseWriter) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func ParseJSONError(buf []byte) (ret struct {
|
||||
ErrorMessage string `json:"errorMessage"`
|
||||
RenderFormat string `json:"renderFormat"`
|
||||
},
|
||||
) {
|
||||
_ = json.Unmarshal(buf, &ret)
|
||||
return ret
|
||||
}
|
||||
|
||||
func IsNormalPageCompleted(s string) bool {
|
||||
return strings.Contains(s, `<footer class="page-footer"`) && strings.Contains(s, `</html>`)
|
||||
}
|
||||
|
Reference in New Issue
Block a user