diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2021-06-07 18:55:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-07 18:55:26 +0200 |
commit | 21cde5c439676d4aaa15dfc79505f364cc849ec0 (patch) | |
tree | 53dc5bce2be061b1de20f39b9c5e07babf113c87 /modules/markup/html_test.go | |
parent | 0909695204a73901b9164b58930cc2e3efe0fe48 (diff) | |
download | gitea-21cde5c439676d4aaa15dfc79505f364cc849ec0.tar.gz gitea-21cde5c439676d4aaa15dfc79505f364cc849ec0.zip |
Fix data URI scramble (#16098)
* Removed unused method.
* No prefix for data uris.
* Added test to prevent regressions.
Diffstat (limited to 'modules/markup/html_test.go')
-rw-r--r-- | modules/markup/html_test.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/modules/markup/html_test.go b/modules/markup/html_test.go index fa8c848601..4c3c2399f5 100644 --- a/modules/markup/html_test.go +++ b/modules/markup/html_test.go @@ -444,3 +444,23 @@ func Test_ParseClusterFuzz(t *testing.T) { assert.NoError(t, err) assert.NotContains(t, res.String(), "<html") } + +func TestIssue16020(t *testing.T) { + setting.AppURL = AppURL + setting.AppSubURL = AppSubURL + + var localMetas = map[string]string{ + "user": "go-gitea", + "repo": "gitea", + } + + data := `<img src="data:image/png;base64,i//V"/>` + + var res strings.Builder + err := PostProcess(&RenderContext{ + URLPrefix: "https://example.com", + Metas: localMetas, + }, strings.NewReader(data), &res) + assert.NoError(t, err) + assert.Equal(t, data, res.String()) +} |