Skip to content

"Wrong persistent file_id specified: wrong string length" when send PhotoSize to user #847

@vartagg

Description

@vartagg

Steps to reproduce

  1. Handle Photo sending by user to your bot and save all of PhotoSize data anywhere

  2. Then send any of these photo-sizes by its file_id like update.effective_message.reply_photo(update.effective_user.id, saved_photo_size_file_id) from your bot to user

Expected behaviour

Photo should be sent from bot to user

Actual behaviour

Error from Telegram API: "Wrong persistent file_id specified: wrong string length"

Configuration

Operating System:
macOS Sierra

Version of Python, python-telegram-bot & dependencies:

python-telegram-bot 8.0
certifi 2017.07.27.1
future 0.16.0
Python 3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13)  [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]

I found that Telegram bot API don't allow to resend thumbnails (PhotoSize): https://core.telegram.org/bots/api#sending-files

Sending by file_id

It is not possible to change the file type when resending by file_id. I.e. a video can't be sent as a photo, a photo can't be sent as a document, etc.
It is not possible to resend thumbnails
Resending a photo by file_id will send all of its sizes.
file_id is unique for each individual bot and can't be transferred from one bot to another.

But effective_attachment of message sending by user has only list of PhotoSize and don't storing file_id of original Photo.

So how to extract file_id of original Photo for resend this in future?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions