aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOdin Ugedal <odin@ugedal.com>2016-03-15 20:06:45 +0100
committerOdin Ugedal <odin@ugedal.com>2016-03-15 20:43:46 +0100
commitf57adf3637a5adc6a892b32b664cd3378c93eb77 (patch)
treee0f7ab15010c78028ff1b592ac389922e3dfcedd
parent9df5c39bca6fb397449525b0f1eb0d24d993439f (diff)
downloadgitea-f57adf3637a5adc6a892b32b664cd3378c93eb77.tar.gz
gitea-f57adf3637a5adc6a892b32b664cd3378c93eb77.zip
Fix relative links in markdown files
Replace spaces with "%20" in "urlPrefix", before markdon processing. The spaces were causing blackfriday (markdown processor) to behave strange. This fixes #2545.
-rw-r--r--modules/markdown/markdown.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/modules/markdown/markdown.go b/modules/markdown/markdown.go
index aad0553afe..27fe09b8f4 100644
--- a/modules/markdown/markdown.go
+++ b/modules/markdown/markdown.go
@@ -357,6 +357,7 @@ OUTER_LOOP:
// Render renders Markdown to HTML with special links.
func Render(rawBytes []byte, urlPrefix string, metas map[string]string) []byte {
+ urlPrefix = strings.Replace(urlPrefix, string(spaceBytes), string(spaceEncodedBytes), -1)
result := RenderRaw(rawBytes, urlPrefix)
result = PostProcess(result, urlPrefix, metas)
result = Sanitizer.SanitizeBytes(result)