Drop the trailing ".git" suffix of the name of new project
When users create new project, they might mistakenly provide a project name with a trailing ".git" suffix which should be dropped. Change-Id: Ica92ee6985a1995e50f74183e7190d670986738d
This commit is contained in:
committed by
David Pursehouse
parent
3e5aba87e8
commit
923380ba5e
@@ -216,11 +216,18 @@ public class CreateProject {
|
||||
}
|
||||
|
||||
if (createProjectArgs.getProjectName().endsWith(Constants.DOT_GIT_EXT)) {
|
||||
createProjectArgs.setProjectName(createProjectArgs.getProjectName()
|
||||
.substring(
|
||||
0,
|
||||
createProjectArgs.getProjectName().length()
|
||||
- Constants.DOT_GIT_EXT.length()));
|
||||
String nameWithoutSuffix = createProjectArgs.getProjectName();
|
||||
// Be nice and drop the trailing ".git" suffix, which we never keep
|
||||
// in our database, but clients might mistakenly provide anyway.
|
||||
//
|
||||
nameWithoutSuffix = nameWithoutSuffix.substring(0, //
|
||||
nameWithoutSuffix.length() - Constants.DOT_GIT_EXT.length());
|
||||
while (nameWithoutSuffix.endsWith("/")) {
|
||||
nameWithoutSuffix =
|
||||
nameWithoutSuffix.substring(0, nameWithoutSuffix.length() - 1);
|
||||
}
|
||||
|
||||
createProjectArgs.setProjectName(nameWithoutSuffix);
|
||||
}
|
||||
|
||||
if (!currentUser.getCapabilities().canCreateProject()) {
|
||||
|
||||
Reference in New Issue
Block a user