Skip to content

Commit dd5a4fd

Browse files
committed
Merge remote-tracking branch 'go-gitea/main' into fix-autofill
2 parents 36ba2ab + 7b87231 commit dd5a4fd

File tree

5 files changed

+28
-5
lines changed

5 files changed

+28
-5
lines changed

modules/markup/markdown/goldmark.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ func (g *ASTTransformer) Transform(node *ast.Document, reader text.Reader, pc pa
114114
wrap := ast.NewLink()
115115
wrap.Destination = link
116116
wrap.Title = v.Title
117+
wrap.SetAttributeString("target", []byte("_blank"))
117118

118119
// Duplicate the current image node
119120
image := ast.NewImage(ast.NewLink())

modules/markup/markdown/markdown_test.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"strings"
99
"testing"
1010

11+
"code.gitea.io/gitea/modules/log"
1112
"code.gitea.io/gitea/modules/markup"
1213
. "code.gitea.io/gitea/modules/markup/markdown"
1314
"code.gitea.io/gitea/modules/setting"
@@ -94,10 +95,11 @@ func TestRender_Images(t *testing.T) {
9495
title := "Train"
9596
href := "https://gitea.io"
9697
result := util.URLJoin(AppSubURL, url)
98+
// hint: With Markdown v2.5.2, there is a new syntax: [link](URL){:target="_blank"} , but we do not support it now
9799

98100
test(
99101
"!["+title+"]("+url+")",
100-
`<p><a href="`+result+`" rel="nofollow"><img src="`+result+`" alt="`+title+`"/></a></p>`)
102+
`<p><a href="`+result+`" target="_blank" rel="nofollow noopener"><img src="`+result+`" alt="`+title+`"/></a></p>`)
101103

102104
test(
103105
"[["+title+"|"+url+"]]",
@@ -109,7 +111,7 @@ func TestRender_Images(t *testing.T) {
109111
url = "/../../.images/src/02/train.jpg"
110112
test(
111113
"!["+title+"]("+url+")",
112-
`<p><a href="`+result+`" rel="nofollow"><img src="`+result+`" alt="`+title+`"/></a></p>`)
114+
`<p><a href="`+result+`" target="_blank" rel="nofollow noopener"><img src="`+result+`" alt="`+title+`"/></a></p>`)
113115

114116
test(
115117
"[["+title+"|"+url+"]]",
@@ -373,6 +375,7 @@ func TestMarkdownRenderRaw(t *testing.T) {
373375
}
374376

375377
for _, testcase := range testcases {
378+
log.Info("Test markdown render error with fuzzy data: %x, the following errors can be recovered", testcase)
376379
_, err := RenderRawString(&markup.RenderContext{}, string(testcase))
377380
assert.NoError(t, err)
378381
}
@@ -382,8 +385,8 @@ func TestRenderSiblingImages_Issue12925(t *testing.T) {
382385
testcase := `![image1](/image1)
383386
![image2](/image2)
384387
`
385-
expected := `<p><a href="/image1" rel="nofollow"><img src="/image1" alt="image1"></a><br>
386-
<a href="/image2" rel="nofollow"><img src="/image2" alt="image2"></a></p>
388+
expected := `<p><a href="/image1" target="_blank" rel="nofollow noopener"><img src="/image1" alt="image1"></a><br>
389+
<a href="/image2" target="_blank" rel="nofollow noopener"><img src="/image2" alt="image2"></a></p>
387390
`
388391
res, err := RenderRawString(&markup.RenderContext{}, testcase)
389392
assert.NoError(t, err)

options/locale/locale_pt-PT.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,6 +1370,12 @@ issues.review.un_resolve_conversation=Passar diálogo ao estado de não resolvid
13701370
issues.review.resolved_by=marcou este diálogo como estando concluído
13711371
issues.assignee.error=Nem todos os responsáveis foram adicionados devido a um erro inesperado.
13721372
issues.reference_issue.body=Conteúdo
1373+
issues.content_history.deleted=eliminado
1374+
issues.content_history.edited=editado
1375+
issues.content_history.created=criado
1376+
issues.content_history.delete_from_history=Eliminar do histórico
1377+
issues.content_history.delete_from_history_confirm=Eliminar do histórico?
1378+
issues.content_history.options=Opções
13731379

13741380
compare.compare_base=base
13751381
compare.compare_head=comparar

options/locale/locale_zh-TW.ini

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,6 +1377,12 @@ issues.review.un_resolve_conversation=取消解決對話
13771377
issues.review.resolved_by=標記了此對話為已解決
13781378
issues.assignee.error=因為未預期的錯誤,未能成功指派所有成員。
13791379
issues.reference_issue.body=內容
1380+
issues.content_history.deleted=刪除
1381+
issues.content_history.edited=編輯
1382+
issues.content_history.created=建立
1383+
issues.content_history.delete_from_history=刪除歷程記錄
1384+
issues.content_history.delete_from_history_confirm=刪除歷程記錄?
1385+
issues.content_history.options=選項
13801386

13811387
compare.compare_base=基底分支
13821388
compare.compare_head=比較
@@ -1985,6 +1991,12 @@ settings.lfs_pointers.inRepo=在儲存庫中
19851991
settings.lfs_pointers.exists=存在於存放區
19861992
settings.lfs_pointers.accessible=使用者可存取
19871993
settings.lfs_pointers.associateAccessible=關聯可存取的 %d 個 OID
1994+
settings.rename_branch_failed_exist=無法重新命名分支,因為目標分支 %s 已存在。
1995+
settings.rename_branch_failed_not_exist=無法重新命名分支 %s,因為他不存在。
1996+
settings.rename_branch_success=分支 %s 已成功被重新命名為 %s。
1997+
settings.rename_branch_from=原分支名稱
1998+
settings.rename_branch_to=新分支名稱
1999+
settings.rename_branch=重新命名分支
19882000

19892001
diff.browse_source=瀏覽代碼
19902002
diff.parent=父節點
@@ -2106,6 +2118,7 @@ branch.create_new_branch=從下列分支建立分支:
21062118
branch.confirm_create_branch=建立分支
21072119
branch.new_branch=建立新分支
21082120
branch.new_branch_from=從「%s」建立新分支
2121+
branch.renamed=分支 %s 被重新命名為 %s。
21092122

21102123
tag.create_tag=建立標籤 <strong>%s</strong>
21112124
tag.create_success=已建立標籤「%s」。

routers/web/user/auth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ func SignInOAuthCallback(ctx *context.Context) {
628628
}
629629

630630
if u == nil {
631-
if !(setting.Service.DisableRegistration || setting.Service.AllowOnlyInternalRegistration) && setting.OAuth2Client.EnableAutoRegistration {
631+
if !setting.Service.AllowOnlyInternalRegistration && setting.OAuth2Client.EnableAutoRegistration {
632632
// create new user with details from oauth2 provider
633633
var missingFields []string
634634
if gothUser.UserID == "" {

0 commit comments

Comments
 (0)