summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2012-07-10 23:29:56 -0400
committerJames Moger <james.moger@gitblit.com>2012-07-10 23:29:56 -0400
commit3fb41fdec5712b792da05e8549c2c0a31f112ca0 (patch)
treeb86d6f753acaa5241a6a00068f441146d854f410
parent2ec0d7fcf3017c3b8f825bd6d1e82da0966b24ca (diff)
downloadgitblit-3fb41fdec5712b792da05e8549c2c0a31f112ca0.tar.gz
gitblit-3fb41fdec5712b792da05e8549c2c0a31f112ca0.zip
Prohibit trailing slashes in repository names (issue 104)
-rw-r--r--src/com/gitblit/client/EditRepositoryDialog.java3
-rw-r--r--src/com/gitblit/wicket/pages/EditRepositoryPage.java3
2 files changed, 6 insertions, 0 deletions
diff --git a/src/com/gitblit/client/EditRepositoryDialog.java b/src/com/gitblit/client/EditRepositoryDialog.java
index f6a315be..77878cbb 100644
--- a/src/com/gitblit/client/EditRepositoryDialog.java
+++ b/src/com/gitblit/client/EditRepositoryDialog.java
@@ -389,6 +389,9 @@ public class EditRepositoryDialog extends JDialog {
error("Relative folder references (../) are prohibited.");
return false;
}
+ if (rname.endsWith("/")) {
+ rname = rname.substring(0, rname.length() - 1);
+ }
// confirm valid characters in repository name
Character c = StringUtils.findInvalidCharacter(rname);
diff --git a/src/com/gitblit/wicket/pages/EditRepositoryPage.java b/src/com/gitblit/wicket/pages/EditRepositoryPage.java
index a6f6af05..0176249b 100644
--- a/src/com/gitblit/wicket/pages/EditRepositoryPage.java
+++ b/src/com/gitblit/wicket/pages/EditRepositoryPage.java
@@ -212,6 +212,9 @@ public class EditRepositoryPage extends RootSubPage {
if (repositoryModel.name.contains("/../")) {
error(getString("gb.illegalRelativeSlash"));
return;
+ }
+ if (repositoryModel.name.endsWith("/")) {
+ repositoryModel.name = repositoryModel.name.substring(0, repositoryModel.name.length() - 1);
}
// confirm valid characters in repository name