mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-01 11:06:06 +01:00
Add validation for label name and color.
This commit is contained in:
@@ -14,13 +14,13 @@ trait LabelsControllerBase extends ControllerBase {
|
||||
case class LabelForm(labelName: String, color: String)
|
||||
|
||||
val newForm = mapping(
|
||||
"newLabelName" -> trim(label("Label name", text(required, maxlength(100)))),
|
||||
"newColor" -> trim(label("Color", text(required, maxlength(7))))
|
||||
"newLabelName" -> trim(label("Label name", text(required, identifier, maxlength(100)))),
|
||||
"newColor" -> trim(label("Color", text(required, color)))
|
||||
)(LabelForm.apply)
|
||||
|
||||
val editForm = mapping(
|
||||
"editLabelName" -> trim(label("Label name", text(required, maxlength(100)))),
|
||||
"editColor" -> trim(label("Color", text(required, maxlength(7))))
|
||||
"editLabelName" -> trim(label("Label name", text(required, identifier, maxlength(100)))),
|
||||
"editColor" -> trim(label("Color", text(required, color)))
|
||||
)(LabelForm.apply)
|
||||
|
||||
post("/:owner/:repository/issues/label/new", newForm)(writableRepository { form =>
|
||||
|
||||
@@ -19,6 +19,8 @@ trait Validations {
|
||||
}
|
||||
}
|
||||
|
||||
def color = pattern("#[0-9a-fA-F]{6}")
|
||||
|
||||
/**
|
||||
* ValueType for the java.util.Date property.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user