fix(markup): make RenderString never fail (#37779)

Fix #37778

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: wxiaoguang <2114189+wxiaoguang@users.noreply.github.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Nicolas <bircni@icloud.com>
This commit is contained in:
Copilot
2026-05-19 16:08:08 +00:00
committed by GitHub
co-authored by copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> wxiaoguang wxiaoguang Nicolas
parent 621aa67e7d
commit 7e436972f9
9 changed files with 37 additions and 34 deletions
+3 -4
View File
@@ -8,7 +8,6 @@ import (
repo_model "code.gitea.io/gitea/models/repo"
"code.gitea.io/gitea/models/unittest"
"code.gitea.io/gitea/modules/markup"
"code.gitea.io/gitea/modules/markup/markdown"
"github.com/stretchr/testify/assert"
@@ -20,7 +19,7 @@ func TestRepoWiki(t *testing.T) {
t.Run("AutoLink", func(t *testing.T) {
rctx := NewRenderContextRepoWiki(t.Context(), repo1).WithMarkupType(markdown.MarkupName)
rendered, err := markup.RenderString(rctx, `
rendered, err := testRenderString(rctx, `
65f1bf27bc3bf70f64657658635e66094edbcb4d
#1
@user2
@@ -35,7 +34,7 @@ func TestRepoWiki(t *testing.T) {
t.Run("AbsoluteAndRelative", func(t *testing.T) {
rctx := NewRenderContextRepoWiki(t.Context(), repo1).WithMarkupType(markdown.MarkupName)
rendered, err := markup.RenderString(rctx, `
rendered, err := testRenderString(rctx, `
[/test](/test)
[./test](./test)
![/image](/image)
@@ -52,7 +51,7 @@ func TestRepoWiki(t *testing.T) {
t.Run("PathInTag", func(t *testing.T) {
rctx := NewRenderContextRepoWiki(t.Context(), repo1).WithMarkupType(markdown.MarkupName)
rendered, err := markup.RenderString(rctx, `
rendered, err := testRenderString(rctx, `
<img src="LINK">
<video src="LINK">
`)