fix(ImageUnfurler): set title for image links (#4215)
This commit is contained in:
parent
4744ee899e
commit
a6d46756f5
|
@ -6,6 +6,7 @@ import (
|
|||
"fmt"
|
||||
"net/http"
|
||||
neturl "net/url"
|
||||
"path"
|
||||
"regexp"
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
@ -105,6 +106,7 @@ func (u *ImageUnfurler) Unfurl() (*common.LinkPreview, error) {
|
|||
return preview, fmt.Errorf("could not build data URI url='%s': %w", u.url.String(), err)
|
||||
}
|
||||
|
||||
preview.Title = path.Base(u.url.Path)
|
||||
preview.Thumbnail.Width = width
|
||||
preview.Thumbnail.Height = height
|
||||
preview.Thumbnail.DataURI = dataURI
|
||||
|
|
|
@ -356,7 +356,7 @@ func (s *MessengerLinkPreviewsTestSuite) Test_UnfurlURLs_Image() {
|
|||
Type: protobuf.UnfurledLink_IMAGE,
|
||||
URL: u,
|
||||
Hostname: "placehold.co",
|
||||
Title: "",
|
||||
Title: "600x400@3x.png",
|
||||
Description: "",
|
||||
Thumbnail: common.LinkPreviewThumbnail{
|
||||
Width: 1293,
|
||||
|
|
Loading…
Reference in New Issue