Merge 77fc7efa30
into ae9dd239fb
This commit is contained in:
commit
e70d411447
|
@ -775,7 +775,7 @@ func (repo *Repository) NextIssueIndex() int64 {
|
|||
}
|
||||
|
||||
var (
|
||||
descPattern = regexp.MustCompile(`https?://\S+`)
|
||||
descPattern = regexp.MustCompile(`https?://[a-zA-Z0-9-_@:;%.,+~#?&/=|!$]+`)
|
||||
)
|
||||
|
||||
// DescriptionHTML does special handles to description and return HTML string.
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
|
@ -176,3 +177,14 @@ func TestTransferOwnership(t *testing.T) {
|
|||
|
||||
CheckConsistencyFor(t, &Repository{}, &User{}, &Team{})
|
||||
}
|
||||
|
||||
func TestRepoDescriptionHTML(t *testing.T) {
|
||||
url := "https://github.com/go-gitea/gitea"
|
||||
description := "GitHub repo: (%s)"
|
||||
repo := &Repository{Description: fmt.Sprintf(description, url)}
|
||||
|
||||
actual := repo.DescriptionHTML()
|
||||
expected := fmt.Sprintf(description,
|
||||
fmt.Sprintf(`<a href="%[1]s" target="_blank" rel="noopener">%[1]s</a>`, url))
|
||||
assert.EqualValues(t, expected, actual)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user