Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

/send/link only produces a small link preview — high-res thumbnail (MediaLinkThumbnail) is not uploaded

Đang mở
#103 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 5 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
go
Lĩnh vực
api, backend

Hướng nghiên cứu

Bắt đầu trong pkg/sendMessage/service/send_service.go tại sendLinkWithRetry, sau đó lần theo wrapper SendMessage nội bộ để xem SendRequestExtra.MediaHandle có thể được truyền qua như thế nào. Sử dụng luồng upload whatsmeow hiện có với MediaLinkThumbnail và gắn các trường thumbnail được trả về cùng kiểu bản xem trước hình ảnh vào ExtendedTextMessage. Hoàn tất khi POST /send/link hiển thị thẻ liên kết độ phân giải cao đồng thời vẫn giữ fallback JPEG nhỏ.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug
Welcome!
  • Yes, I have searched for similar issues on GitHub and found none.
What did you do?

I sent a message through POST /send/link with a real URL and an OG image, expecting the big rich link-preview card you get when a normal user pastes a link into WhatsApp. The imgUrl is populated (or auto-fetched from the page metadata).

Roughly this body:

{
  "number": "<group>@g.us",
  "text": "…summary text… https://example.com/trail",
  "url": "https://example.com/trail",
  "title": "…",
  "description": "…",
  "imgUrl": "https://example.com/image-1200x630.jpg"
}
What did you expect?

A large link-preview card — the OG image rendered big at the top of the message, tapping through to the URL.

It reproduces every time. The image loads fine, so this is specifically about the large-vs-small render path (the missing MediaLinkThumbnail upload), not the image failing to show.

What did you observe instead of what you expected?

Only the small preview shows up: a little thumbnail on the left side, no matter how large the OG image is. So it works, it's just always the small variant.

The image itself embeds fine — I checked the outgoing message and it carries the full 1200×630 image as a ~297 KB JPEGThumbnail. WhatsApp just renders it small.

The reason is in sendLinkWithRetry (pkg/sendMessage/service/send_service.go, around lines 754–762). The ExtendedTextMessage is built with only the inline thumbnail:

previewType := waE2E.ExtendedTextMessage_VIDEO
msg := &waE2E.Message{
    ExtendedTextMessage: &waE2E.ExtendedTextMessage{
        Text:          &data.Text, 
        Title:         &data.Title,
        MatchedText:   &matchedText,
        JPEGThumbnail: fileData,   
        Description:   &data.Description,
        PreviewType:   &previewType,
    },
}

Two things stand out. First, it never uploads a high-res link thumbnail, so ThumbnailDirectPath, ThumbnailSHA256, ThumbnailEncSHA256, ThumbnailWidth and ThumbnailHeight are all unset — and those fields (plus the MediaHandle on send) are exactly what WhatsApp needs to render the large card. An inline JPEGThumbnail on its own always renders small, at any resolution. Second, PreviewType is hardcoded to VIDEO for what are image links, even though the enum has a dedicated IMAGE (5).

Screenshots/Videos

No response

Which version are you using?

0.7.1

What is your environment?

Docker

If applicable, paste the log output

Here's the outgoing message (trimmed) from a POST /send/link call:

Info.Type: "ExtendedTextMessage"   
Message.extendedTextMessage:
  matchedText:   "https://example.com/trail"
  title:         "…"
  description:   "…"
  previewType:   1                 # VIDEO
  JPEGThumbnail: <~297 KB, 1200×630 jpeg>
  # thumbnailDirectPath / thumbnailSha256 / thumbnailEncSha256 /
  # thumbnailWidth / thumbnailHeight  — all absent
  # no MediaHandle passed on send  
Additional Notes

Suggested Fix:

Happy to Contribute.

The gist is to upload the fetched image as a link thumbnail and wire the returned fields onto the message:

up, err := client.Upload(ctx, fileData, whatsmeow.MediaLinkThumbnail)
// then on the ExtendedTextMessage:
//   ThumbnailDirectPath  = &up.DirectPath
//   ThumbnailSHA256      = up.FileSHA256
//   ThumbnailEncSHA256   = up.FileEncSHA256
//   ThumbnailWidth/Height = <decoded dims>
//   JpegThumbnail        = <small ~100px jpeg>   // keep for the fallback
//   PreviewType          = IMAGE  

…and pass the upload handle through on send:

client.SendMessage(ctx, jid, msg, whatsmeow.SendRequestExtra{ MediaHandle: up.Handle })

This will probably mean threading SendRequestExtra.MediaHandle through the internal SendMessage wrapper, which doesn't currently expose it.

Ngôn ngữ chính
Go
Star
890
Fork
473
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

  • Có Dockerfile hoặc tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của evolution-foundation/evolution-go

Tất cả issue của evolution-foundation/evolution-go

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.