-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
client: handle card and tweet attachment #50
Conversation
linkPreview.ImageWidth = media.OriginalInfo.Width | ||
linkPreview.ImageHeight = media.OriginalInfo.Height | ||
linkPreview.ImageSize = int(resp.ContentLength) | ||
linkPreview.ImageURL, _, err = intent.UploadMediaStream(ctx, portal.MXID, resp.ContentLength, false, func(file io.Writer) (*bridgev2.FileStreamResult, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't figure out why ImageURL
is empty and err
is nil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
downloadFile
's error doesn't seem to be handled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true, but in my testing, ImageWidth
, ImageHeight
, ImageSize
all have values, only ImageURL
is empty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested again with synapse, image was uploaded fine
"com.beeper.linkpreviews": [
{
"og:url": "https://x.com/*",
"og:title": "* on X",
"og:description": "**. https://t.co/*",
"og:image": "mxc://*.*/wKtjAnYXjafJtLrKZsKcRLDh",
"matrix:image:size": 47126,
"og:image:width": 903,
"og:image:height": 984,
"og:image:type": "image/jpeg"
}
So maybe a problem with my bridge-manager setup.
content := bridgeEvt.MessageEventContent{ | ||
MsgType: bridgeEvt.MsgText, | ||
BeeperLinkPreviews: []*bridgeEvt.BeeperLinkPreview{tc.attachmentCardToMatrix(ctx, attachment.Card, msg.Entities.URLs)}, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should probably include the card/tweet url in body rather than just a link preview
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other fields are placeholders here, only the BeeperLinkPreviews
fields is used in client.go. The card/tweet url is still in the textPart, which will be expanded in my next PR
if msg.Attachment.Card != nil || msg.Attachment.Tweet != nil {
textPart.Content.BeeperLinkPreviews = convertedAttachmentPart.Content.BeeperLinkPreviews
}
linkPreview.ImageWidth = media.OriginalInfo.Width | ||
linkPreview.ImageHeight = media.OriginalInfo.Height | ||
linkPreview.ImageSize = int(resp.ContentLength) | ||
linkPreview.ImageURL, _, err = intent.UploadMediaStream(ctx, portal.MXID, resp.ContentLength, false, func(file io.Writer) (*bridgev2.FileStreamResult, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
downloadFile
's error doesn't seem to be handled?
c25a933
to
587f97f
Compare
No description provided.