go-whatsapp
go-whatsapp copied to clipboard
Image: file length does not match
In my app this error message appeared when a group of four images were received. The app could only download the first one. The remaining three resulted in the error message. That's odd. What might be happened? Could the error be due the images appear grouped in the device? I tried to reproduce the problem to no avail.
I suggest adding to the error message the received size and the expected one.
I changed the error message, to be more specific. Can you please retry and give us some feedback on the problem?
It looks like that even the official API has this issue. I know that exists an opened ticket with same subject on their hands.
Hello, since yesterday I have faced this same problem
I changed the library to ignore the length, the image arrives and is correct, I'll leave it at that for now as I don't know if this will be corrected, I'll post only the link that I changed.
https://github.com/Valdenirmezadri/go-whatsapp/commit/94fdcb098801ac867c22b64470f2c721ca6f936e
then on my app:
func (h *WhatsAppAPI) imageDownload(message whatsapp.ImageMessage) ([]byte, error) { file, err := message.Download() if err != nil { if err == whatsapp.ErrMediaFileLengthDoesNotMatch { return file, nil } ...
I have same problem.
It seems to happen very sporadically. Today it happened for just one device for some images sent just by one number.
I changed the library to ignore the length, the image arrives and is correct, I'll leave it at that for now as I don't know if this will be corrected, I'll post only the link that I changed.
It solves the problem and indeed the image is correct. But I am not sure if the image will be always correct. I am pretty sure that just one byte is being added somewhere (not by go-whatsapp).
It seems to happen very sporadically. Today it happened for just one device for some images sent just by one number.
yes, it is not all images that occur the problem, I realized that it occurs more when it is an image forwarded from another whatsapp. I have an image with this problem, I can send you if you want to test
I changed the library to ignore the length, the image arrives and is correct, I'll leave it at that for now as I don't know if this will be corrected, I'll post only the link that I changed.
It solves the problem and indeed the image is correct. But I am not sure if the image will be always correct. I am pretty sure that just one byte is being added somewhere (not by go-whatsapp).
What i can tell you here, is that all the images that occurred this error were photos taken by the cell phone camera and forwarded to WhatsApp