"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "modules/markup/html_test.go" between
gitea-1.13.1.tar.gz and gitea-1.13.2.tar.gz

About: Gitea allows to set up a self-hosted code hosting Git service (a fork of Gogs).

html_test.go  (gitea-1.13.1):html_test.go  (gitea-1.13.2)
skipping to change at line 49 skipping to change at line 49
test(sha, `<p><a href="`+commit+`" rel="nofollow"><code>65f1bf27bc</code> </a></p>`) test(sha, `<p><a href="`+commit+`" rel="nofollow"><code>65f1bf27bc</code> </a></p>`)
test(sha[:7], `<p><a href="`+commit[:len(commit)-(40-7)]+`" rel="nofollow "><code>65f1bf2</code></a></p>`) test(sha[:7], `<p><a href="`+commit[:len(commit)-(40-7)]+`" rel="nofollow "><code>65f1bf2</code></a></p>`)
test(sha[:39], `<p><a href="`+commit[:len(commit)-(40-39)]+`" rel="nofoll ow"><code>65f1bf27bc</code></a></p>`) test(sha[:39], `<p><a href="`+commit[:len(commit)-(40-39)]+`" rel="nofoll ow"><code>65f1bf27bc</code></a></p>`)
test(commit, `<p><a href="`+commit+`" rel="nofollow"><code>65f1bf27bc</co de></a></p>`) test(commit, `<p><a href="`+commit+`" rel="nofollow"><code>65f1bf27bc</co de></a></p>`)
test(tree, `<p><a href="`+tree+`" rel="nofollow"><code>65f1bf27bc/src</co de></a></p>`) test(tree, `<p><a href="`+tree+`" rel="nofollow"><code>65f1bf27bc/src</co de></a></p>`)
test("commit "+sha, `<p>commit <a href="`+commit+`" rel="nofollow"><code> 65f1bf27bc</code></a></p>`) test("commit "+sha, `<p>commit <a href="`+commit+`" rel="nofollow"><code> 65f1bf27bc</code></a></p>`)
test("/home/gitea/"+sha, "<p>/home/gitea/"+sha+"</p>") test("/home/gitea/"+sha, "<p>/home/gitea/"+sha+"</p>")
test("deadbeef", `<p>deadbeef</p>`) test("deadbeef", `<p>deadbeef</p>`)
test("d27ace93", `<p>d27ace93</p>`) test("d27ace93", `<p>d27ace93</p>`)
test(sha[:14]+".x", `<p>`+sha[:14]+`.x</p>`)
expected14 := `<a href="` + commit[:len(commit)-(40-14)] + `" rel="nofoll
ow"><code>` + sha[:10] + `</code></a>`
test(sha[:14]+".", `<p>`+expected14+`.</p>`)
test(sha[:14]+",", `<p>`+expected14+`,</p>`)
test("["+sha[:14]+"]", `<p>[`+expected14+`]</p>`)
} }
func TestRender_CrossReferences(t *testing.T) { func TestRender_CrossReferences(t *testing.T) {
setting.AppURL = AppURL setting.AppURL = AppURL
setting.AppSubURL = AppSubURL setting.AppSubURL = AppSubURL
test := func(input, expected string) { test := func(input, expected string) {
buffer := RenderString("a.md", input, setting.AppSubURL, localMet as) buffer := RenderString("a.md", input, setting.AppSubURL, localMet as)
assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(bu ffer)) assert.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(bu ffer))
} }
skipping to change at line 380 skipping to change at line 386
`<p><a href="`+encodedImgurlWiki+`" rel="nofollow"><img src="`+en codedImgurlWiki+`" title="Title" alt="AltName"/></a></p>`) `<p><a href="`+encodedImgurlWiki+`" rel="nofollow"><img src="`+en codedImgurlWiki+`" title="Title" alt="AltName"/></a></p>`)
test( test(
"[[some/path/Link #.jpg]]", "[[some/path/Link #.jpg]]",
`<p><a href="`+notencodedImgurl+`" rel="nofollow"><img src="`+not encodedImgurl+`" title="Link #.jpg" alt="some/path/Link #.jpg"/></a></p>`, `<p><a href="`+notencodedImgurl+`" rel="nofollow"><img src="`+not encodedImgurl+`" title="Link #.jpg" alt="some/path/Link #.jpg"/></a></p>`,
`<p><a href="`+notencodedImgurlWiki+`" rel="nofollow"><img src="` +notencodedImgurlWiki+`" title="Link #.jpg" alt="some/path/Link #.jpg"/></a></p> `) `<p><a href="`+notencodedImgurlWiki+`" rel="nofollow"><img src="` +notencodedImgurlWiki+`" title="Link #.jpg" alt="some/path/Link #.jpg"/></a></p> `)
test( test(
"<p><a href=\"https://example.org\">[[foobar]]</a></p>", "<p><a href=\"https://example.org\">[[foobar]]</a></p>",
`<p><a href="https://example.org" rel="nofollow">[[foobar]]</a></ p>`, `<p><a href="https://example.org" rel="nofollow">[[foobar]]</a></ p>`,
`<p><a href="https://example.org" rel="nofollow">[[foobar]]</a></ p>`) `<p><a href="https://example.org" rel="nofollow">[[foobar]]</a></ p>`)
} }
func Test_ParseClusterFuzz(t *testing.T) {
setting.AppURL = AppURL
setting.AppSubURL = AppSubURL
var localMetas = map[string]string{
"user": "go-gitea",
"repo": "gitea",
}
data := "<A><maTH><tr><MN><bodY ÿ><temPlate></template><tH><tr></A><tH><d
<bodY "
val, err := PostProcess([]byte(data), "https://example.com", localMetas,
false)
assert.NoError(t, err)
assert.NotContains(t, string(val), "<html")
data = "<!DOCTYPE html>\n<A><maTH><tr><MN><bodY ÿ><temPlate></template><t
H><tr></A><tH><d<bodY "
val, err = PostProcess([]byte(data), "https://example.com", localMetas, f
alse)
assert.NoError(t, err)
assert.NotContains(t, string(val), "<html")
}
 End of changes. 2 change blocks. 
0 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)