summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authormrsdizzie <info@mrsdizzie.com>2020-02-17 00:46:51 -0500
committerGitHub <noreply@github.com>2020-02-17 07:46:51 +0200
commitb5f28d154d16e03367da5d83a39a1aca0e26783d (patch)
treefb5b9248a3711ca14ee794d5592ace887f32254e /modules
parent7af6f8b46560177968023abac9fc7141a856903b (diff)
downloadgitea-b5f28d154d16e03367da5d83a39a1aca0e26783d.tar.gz
gitea-b5f28d154d16e03367da5d83a39a1aca0e26783d.zip
Don't manually replace whitespace during render (#10291)
* Don't manually replace whitespace during render For historical reasons Gitea manually alters the urlPrefix and replaces a whitespace with a +. This Works for URLs, but we're also passing urlPrefix to git calls and adding the + is breaking the tree path. Goldmark will automatically convert a white space to the proper %20, so we should leave the string as is which lets us pass it to git unmodified and then let Goldmark fix it. Also fixed separate bug in URLJoin I noticed while testing where it will silently discard sections of a path that have # in them (possibly others). We should just escape it first. Fixes 10156 * Escape elems as well * Revert "Escape elems as well" This reverts commit 8bf49596fee6fac4d9da256cd1e90a0ec0183671. * restart ci * remove changes to URLJoin * restart ci Co-authored-by: techknowlogick <matti@mdranta.net>
Diffstat (limited to 'modules')
-rw-r--r--modules/markup/markdown/goldmark.go1
-rw-r--r--modules/markup/markup.go1
2 files changed, 0 insertions, 2 deletions
diff --git a/modules/markup/markdown/goldmark.go b/modules/markup/markdown/goldmark.go
index a1c8e1ded0..a9475b58c5 100644
--- a/modules/markup/markdown/goldmark.go
+++ b/modules/markup/markdown/goldmark.go
@@ -52,7 +52,6 @@ func (g *GiteaASTTransformer) Transform(node *ast.Document, reader text.Reader,
lnk := string(link)
lnk = giteautil.URLJoin(prefix, lnk)
- lnk = strings.Replace(lnk, " ", "+", -1)
link = []byte(lnk)
}
v.Destination = link
diff --git a/modules/markup/markup.go b/modules/markup/markup.go
index 008b21ab97..f8deb2b29b 100644
--- a/modules/markup/markup.go
+++ b/modules/markup/markup.go
@@ -81,7 +81,6 @@ func RenderWiki(filename string, rawBytes []byte, urlPrefix string, metas map[st
}
func render(parser Parser, rawBytes []byte, urlPrefix string, metas map[string]string, isWiki bool) []byte {
- urlPrefix = strings.Replace(urlPrefix, " ", "+", -1)
result := parser.Render(rawBytes, urlPrefix, metas, isWiki)
// TODO: one day the error should be returned.
result, err := PostProcess(result, urlPrefix, metas, isWiki)