mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-10-31 22:38:58 +00:00
Merge pull request '[GITEA] Fix relative links rendering' (#2167) from gusted/forgejo-bp-2166 into v1.21/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2167 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
This commit is contained in:
commit
b1b3ba8013
2 changed files with 4 additions and 2 deletions
|
@ -137,6 +137,8 @@ func (g *ASTTransformer) Transform(node *ast.Document, reader text.Reader, pc pa
|
||||||
var base string
|
var base string
|
||||||
if ctx.IsWiki {
|
if ctx.IsWiki {
|
||||||
base = ctx.Links.WikiLink()
|
base = ctx.Links.WikiLink()
|
||||||
|
} else if ctx.Links.HasBranchInfo() {
|
||||||
|
base = ctx.Links.SrcLink()
|
||||||
} else {
|
} else {
|
||||||
base = ctx.Links.Base
|
base = ctx.Links.Base
|
||||||
}
|
}
|
||||||
|
|
|
@ -765,7 +765,7 @@ space</p>
|
||||||
Expected: `<p>space @mention-user<br/>
|
Expected: `<p>space @mention-user<br/>
|
||||||
/just/a/path.bin<br/>
|
/just/a/path.bin<br/>
|
||||||
<a href="https://example.com/file.bin" rel="nofollow">https://example.com/file.bin</a><br/>
|
<a href="https://example.com/file.bin" rel="nofollow">https://example.com/file.bin</a><br/>
|
||||||
<a href="/user/repo/file.bin" rel="nofollow">local link</a><br/>
|
<a href="/user/repo/src/branch/main/file.bin" rel="nofollow">local link</a><br/>
|
||||||
<a href="https://example.com" rel="nofollow">remote link</a><br/>
|
<a href="https://example.com" rel="nofollow">remote link</a><br/>
|
||||||
<a href="/user/repo/src/branch/main/file.bin" rel="nofollow">local link</a><br/>
|
<a href="/user/repo/src/branch/main/file.bin" rel="nofollow">local link</a><br/>
|
||||||
<a href="https://example.com" rel="nofollow">remote link</a><br/>
|
<a href="https://example.com" rel="nofollow">remote link</a><br/>
|
||||||
|
@ -878,7 +878,7 @@ space</p>
|
||||||
Expected: `<p>space @mention-user<br/>
|
Expected: `<p>space @mention-user<br/>
|
||||||
/just/a/path.bin<br/>
|
/just/a/path.bin<br/>
|
||||||
<a href="https://example.com/file.bin" rel="nofollow">https://example.com/file.bin</a><br/>
|
<a href="https://example.com/file.bin" rel="nofollow">https://example.com/file.bin</a><br/>
|
||||||
<a href="/user/repo/file.bin" rel="nofollow">local link</a><br/>
|
<a href="/user/repo/src/branch/main/sub/folder/file.bin" rel="nofollow">local link</a><br/>
|
||||||
<a href="https://example.com" rel="nofollow">remote link</a><br/>
|
<a href="https://example.com" rel="nofollow">remote link</a><br/>
|
||||||
<a href="/user/repo/src/branch/main/sub/folder/file.bin" rel="nofollow">local link</a><br/>
|
<a href="/user/repo/src/branch/main/sub/folder/file.bin" rel="nofollow">local link</a><br/>
|
||||||
<a href="https://example.com" rel="nofollow">remote link</a><br/>
|
<a href="https://example.com" rel="nofollow">remote link</a><br/>
|
||||||
|
|
Loading…
Reference in a new issue