MM-12648: Properly unescape OpenGraph metadata containing HTML entities. (#9891)

Этот коммит содержится в:
George Goldberg
2018-11-28 10:58:12 +00:00
коммит произвёл GitHub
родитель 4294758793
Коммит 9afb1586cd
2 изменённых файлов: 22 добавлений и 1 удалений

Просмотреть файл

@@ -8,6 +8,7 @@ import (
"testing"
"github.com/dyatlov/go-opengraph/opengraph"
"github.com/stretchr/testify/assert"
)
func BenchmarkForceHTMLEncodingToUTF8(b *testing.B) {
@@ -127,3 +128,14 @@ func TestMakeOpenGraphURLsAbsolute(t *testing.T) {
})
}
}
func TestOpenGraphDecodeHtmlEntities(t *testing.T) {
og := opengraph.NewOpenGraph()
og.Title = "Test's are the best.©"
og.Description = "Test's are the worst.©"
openGraphDecodeHtmlEntities(og)
assert.Equal(t, og.Title, "Test's are the best.©")
assert.Equal(t, og.Description, "Test's are the worst.©")
}