]> source.dussan.org Git - gitblit.git/commitdiff
Fixed IOOB exception in StringUtils.getRelativePath (issue-256)
authorJames Moger <james.moger@gitblit.com>
Wed, 19 Jun 2013 19:10:59 +0000 (15:10 -0400)
committerJames Moger <james.moger@gitblit.com>
Wed, 19 Jun 2013 19:10:59 +0000 (15:10 -0400)
src/main/java/com/gitblit/utils/StringUtils.java

index 86823db5cc5a854fd24308a09795f5c39a5554c4..cff3577d051d59640f24c66290f0fcafe4010b41 100644 (file)
@@ -331,7 +331,7 @@ public class StringUtils {
                String fp = fullPath.replace('\\', '/').toLowerCase();\r
                if (fp.startsWith(bp)) {\r
                        String relativePath = fullPath.substring(basePath.length()).replace('\\', '/');\r
-                       if (relativePath.charAt(0) == '/') {\r
+                       if (relativePath.length() > 0 && relativePath.charAt(0) == '/') {\r
                                relativePath = relativePath.substring(1);\r
                        }\r
                        return relativePath;\r