]> source.dussan.org Git - gitblit.git/commitdiff
Strip leading / for absolute wiki link paths
authorJames Moger <james.moger@gitblit.com>
Fri, 25 Oct 2013 22:12:09 +0000 (18:12 -0400)
committerJames Moger <james.moger@gitblit.com>
Fri, 25 Oct 2013 22:32:25 +0000 (18:32 -0400)
Change-Id: Ic475d570a3438916cd952d317338df1756c8be5a

src/main/java/com/gitblit/wicket/pages/RepositoryPage.java

index 68aa9a7ab1a503f45e27d5a95556770df58108a5..bc7dfa93a264b882072e8a3d715674f6118dbb8a 100644 (file)
@@ -660,10 +660,12 @@ public abstract class RepositoryPage extends RootPage {
                        public Rendering render(WikiLinkNode node) {\r
                                try {\r
                                        String fsc = GitBlit.getString(Keys.web.forwardSlashCharacter, "/");\r
-                                       String path = URLEncoder.encode(node.getText().replace(' ', '-'), "UTF-8").replace("%2F", fsc);\r
+                                       // adjust the request path\r
+                                       String path = node.getText().charAt(0) == '/' ? node.getText().substring(1) : node.getText();\r
+                                       path = URLEncoder.encode(path.replace(' ', '-'), "UTF-8").replace("%2F", fsc);\r
 \r
                                        // extract document name\r
-                                       String name = node.getText();\r
+                                       String name = node.getText().replace('_', ' ');\r
                                        if (name.indexOf('/') > -1) {\r
                                                name = name.substring(name.lastIndexOf('/') + 1);\r
                                        }\r