mirror of
https://github.com/gitbucket/gitbucket.git
synced 2026-01-04 14:50:02 +01:00
(refs #802)Allow '+' in repository name
This commit is contained in:
@@ -91,7 +91,7 @@ trait AccountControllerBase extends AccountManagementControllerBase {
|
||||
|
||||
val newRepositoryForm = mapping(
|
||||
"owner" -> trim(label("Owner" , text(required, maxlength(40), identifier, existsAccount))),
|
||||
"name" -> trim(label("Repository name", text(required, maxlength(40), identifier, uniqueRepository))),
|
||||
"name" -> trim(label("Repository name", text(required, maxlength(40), repository, uniqueRepository))),
|
||||
"description" -> trim(label("Description" , optional(text()))),
|
||||
"isPrivate" -> trim(label("Repository Type", boolean())),
|
||||
"createReadme" -> trim(label("Create README" , boolean()))
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.scalatra.i18n.Messages
|
||||
trait Validations {
|
||||
|
||||
/**
|
||||
* Constraint for the identifier such as user name, repository name or page name.
|
||||
* Constraint for the identifier such as user name or page name.
|
||||
*/
|
||||
def identifier: Constraint = new Constraint(){
|
||||
override def validate(name: String, value: String, messages: Messages): Option[String] =
|
||||
@@ -19,6 +19,23 @@ trait Validations {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constraint for the repository identifier.
|
||||
*/
|
||||
def repository: Constraint = new Constraint(){
|
||||
override def validate(name: String, value: String, messages: Messages): Option[String] =
|
||||
if(!value.matches("[a-zA-Z0-9\\-\\+_.]+")){
|
||||
Some(s"${name} contains invalid character.")
|
||||
} else if(value.startsWith("_") || value.startsWith("-")){
|
||||
Some(s"${name} starts with invalid character.")
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constraint for the color pattern.
|
||||
*/
|
||||
def color = pattern("#[0-9a-fA-F]{6}")
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user