Skip to content

Commit 5117cac

Browse files
committed
Links in markdown should be absolute to the repository not the server
Fix #15075 Signed-off-by: Andrew Thornton <[email protected]>
1 parent 17731e0 commit 5117cac

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

modules/markup/markdown/goldmark.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package markdown
77
import (
88
"bytes"
99
"fmt"
10+
"path"
1011
"regexp"
1112
"strings"
1213

@@ -99,6 +100,8 @@ func (g *ASTTransformer) Transform(node *ast.Document, reader text.Reader, pc pa
99100
prefix = strings.Replace(prefix, "/src/", "/media/", 1)
100101

101102
lnk := string(link)
103+
lnk = path.Clean("/" + lnk)[1:]
104+
102105
lnk = giteautil.URLJoin(prefix, lnk)
103106
link = []byte(lnk)
104107
}

0 commit comments

Comments
 (0)