summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorFlorian Zschocke <f.zschocke+git@gmail.com>2021-12-04 15:05:58 +0100
committerFlorian Zschocke <f.zschocke+git@gmail.com>2021-12-04 15:05:58 +0100
commit1f0ddcebfc2edc89a929461f81143262a176a2ad (patch)
tree7052cd0e47abb11fb242da6aff920ed083b19a61 /src/main
parente54c39bdac385005c0156f2d5b8dca82ab4d6ddf (diff)
downloadgitblit-1f0ddcebfc2edc89a929461f81143262a176a2ad.tar.gz
gitblit-1f0ddcebfc2edc89a929461f81143262a176a2ad.zip
bug: Fix double encoding links in Markdown/Wiki pages
When parsing Markdown or Wiki pages, links get URL encoded. This happened twice for links to other documents. Once explicitly and once by Wicket when it creates a `urlFor` the page. That results in multi-byte characters getting percent escaped, and then the percent character again getting percent escaped. The explicit encoding looks like a forgotten left over, so it gets removed from the code. The Wicket encoding is smarter anyways, knowing what is path and what is parameter. This fixes #864.
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/gitblit/wicket/MarkupProcessor.java5
1 files changed, 0 insertions, 5 deletions
diff --git a/src/main/java/com/gitblit/wicket/MarkupProcessor.java b/src/main/java/com/gitblit/wicket/MarkupProcessor.java
index 300039bc..15e54332 100644
--- a/src/main/java/com/gitblit/wicket/MarkupProcessor.java
+++ b/src/main/java/com/gitblit/wicket/MarkupProcessor.java
@@ -391,11 +391,6 @@ public class MarkupProcessor {
private String getWicketUrl(Class<? extends Page> pageClass, final String repositoryName, final String commitId, final String document) {
String fsc = settings.getString(Keys.web.forwardSlashCharacter, "/");
String encodedPath = document.replace(' ', '-');
- try {
- encodedPath = URLEncoder.encode(encodedPath, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- logger.error(null, e);
- }
encodedPath = encodedPath.replace("/", fsc).replace("%2F", fsc);
String url = RequestCycle.get().urlFor(pageClass, WicketUtils.newPathParameter(repositoryName, commitId, encodedPath)).toString();