mirror of
https://github.com/anyproto/anytype-heart.git
synced 2025-06-09 09:35:00 +09:00
#474: check url
This commit is contained in:
parent
a0f90da715
commit
d6a9b90fcf
1 changed files with 8 additions and 1 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue