]> source.dussan.org Git - gitblit.git/commitdiff
Prohibit trailing slashes in repository names (issue 104)
authorJames Moger <james.moger@gitblit.com>
Wed, 11 Jul 2012 03:29:56 +0000 (23:29 -0400)
committerJames Moger <james.moger@gitblit.com>
Wed, 11 Jul 2012 03:29:56 +0000 (23:29 -0400)
src/com/gitblit/client/EditRepositoryDialog.java
src/com/gitblit/wicket/pages/EditRepositoryPage.java

index f6a315be8987239b17a1ef51a675efe7de611495..77878cbb14dc27fe77016f9e4411a9ea9c065021 100644 (file)
@@ -389,6 +389,9 @@ public class EditRepositoryDialog extends JDialog {
                        error("Relative folder references (../) are prohibited.");\r
                        return false;\r
                }\r
+               if (rname.endsWith("/")) {\r
+                       rname = rname.substring(0, rname.length() - 1);\r
+               }\r
 \r
                // confirm valid characters in repository name\r
                Character c = StringUtils.findInvalidCharacter(rname);\r
index a6f6af05804566d9daf2db155a85f3ab2940ca9e..0176249bbf0c60086008d6d40293b1d4098dbb82 100644 (file)
@@ -212,6 +212,9 @@ public class EditRepositoryPage extends RootSubPage {
                                        if (repositoryModel.name.contains("/../")) {\r
                                                error(getString("gb.illegalRelativeSlash"));\r
                                                return;\r
+                                       }                                       \r
+                                       if (repositoryModel.name.endsWith("/")) {\r
+                                               repositoryModel.name = repositoryModel.name.substring(0, repositoryModel.name.length() - 1);\r
                                        }\r
 \r
                                        // confirm valid characters in repository name\r