From 1f0ddcebfc2edc89a929461f81143262a176a2ad Mon Sep 17 00:00:00 2001 From: Florian Zschocke Date: Sat, 4 Dec 2021 15:05:58 +0100 Subject: [PATCH] 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. --- src/main/java/com/gitblit/wicket/MarkupProcessor.java | 5 ----- 1 file changed, 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 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(); -- 2.39.5