1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-09 09:35:00 +09:00
This commit is contained in:
Kirill 2020-06-19 18:44:35 +03:00
parent a0f90da715
commit d6a9b90fcf
No known key found for this signature in database
GPG key ID: 52B176BB96D272ED

View file

@ -9,6 +9,8 @@ import (
"strings"
"unicode/utf8"
"github.com/anytypeio/go-anytype-middleware/util/uri"
"github.com/anytypeio/go-anytype-library/pb/model"
"github.com/mauidude/go-readability"
"github.com/microcosm-cc/bluemonday"
@ -64,9 +66,14 @@ func (l *linkPreview) convertOGToInfo(og *opengraph.OpenGraph) (i model.LinkPrev
og.URL.RawQuery = ""
i.FaviconUrl = og.URL.String()
}
if len(og.Image) != 0 {
i.ImageUrl = og.Image[0].URL
url, err := uri.ProcessURI(og.Image[0].URL)
if err == nil {
i.ImageUrl = url
}
}
return
}