1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-27 20:58:36 +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:
Kemal Zebari
2025-06-07 01:25:08 -07:00
committed by GitHub
parent b38f2d31fd
commit 47d69b7749
9 changed files with 151 additions and 76 deletions

View File

@@ -5,7 +5,7 @@
>
<div class="header"></div>
<div class="content">
<form class="ui form ignore-dirty" method="post">
<form class="ui form ignore-dirty form-fetch-action" method="post">
{{.CsrfTokenHtml}}
<input name="id" type="hidden">
<div class="required field">
@@ -50,7 +50,8 @@
<div class="field">
<label for="color">{{ctx.Locale.Tr "repo.issues.label_color"}}</label>
<div class="column js-color-picker-input">
<input name="color" value="#70c24a" placeholder="#c320f6" required maxlength="7">
<!-- the "#" is optional because backend NormalizeColor is able to handle it, API also accepts both formats, and it is easier for users to directly copy-paste a hex value -->
<input name="color" value="#70c24a" placeholder="#c320f6" required pattern="^#?([\dA-Fa-f]{3}|[\dA-Fa-f]{6})$" maxlength="7">
{{template "repo/issue/label_precolors"}}
</div>
</div>