diff options
author | James Moger <james.moger@gitblit.com> | 2013-10-25 18:12:09 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2013-10-25 18:32:25 -0400 |
commit | aae137d5da475ec72f271811a848d426f05c1b8e (patch) | |
tree | da4aa06c25808d45f261dff308831cf4d0af9a38 | |
parent | ba297061e7f5e1f447435d09fd121be0008cee8e (diff) | |
download | gitblit-aae137d5da475ec72f271811a848d426f05c1b8e.tar.gz gitblit-aae137d5da475ec72f271811a848d426f05c1b8e.zip |
Strip leading / for absolute wiki link paths
Change-Id: Ic475d570a3438916cd952d317338df1756c8be5a
-rw-r--r-- | src/main/java/com/gitblit/wicket/pages/RepositoryPage.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/com/gitblit/wicket/pages/RepositoryPage.java b/src/main/java/com/gitblit/wicket/pages/RepositoryPage.java index 68aa9a7a..bc7dfa93 100644 --- a/src/main/java/com/gitblit/wicket/pages/RepositoryPage.java +++ b/src/main/java/com/gitblit/wicket/pages/RepositoryPage.java @@ -660,10 +660,12 @@ public abstract class RepositoryPage extends RootPage { public Rendering render(WikiLinkNode node) {
try {
String fsc = GitBlit.getString(Keys.web.forwardSlashCharacter, "/");
- String path = URLEncoder.encode(node.getText().replace(' ', '-'), "UTF-8").replace("%2F", fsc);
+ // adjust the request path
+ String path = node.getText().charAt(0) == '/' ? node.getText().substring(1) : node.getText();
+ path = URLEncoder.encode(path.replace(' ', '-'), "UTF-8").replace("%2F", fsc);
// extract document name
- String name = node.getText();
+ String name = node.getText().replace('_', ' ');
if (name.indexOf('/') > -1) {
name = name.substring(name.lastIndexOf('/') + 1);
}
|