FILE_REFERENCE_EXPIRED at upload.getFile with inputPhotoFileLocation

623 Views Asked by At

Can't get content from method upload.getFile using inputPhotoFileLocation, getting exeption FILE_REFERENCE_EXPIRED, readed lots of forums but cant get answer I'm using MTProto client on js

this.call('upload.getFile', {
    location: {
        _: 'inputPhotoFileLocation',
        id: message.media.photo.id,
        access_hash: message.media.photo.access_hash,
        file_reference: message.media.photo.file_reference, //tried
            //Buffer.from(message.media.photo.file_reference.toString('hex'), 'hex'),
            //[...message.media.photo.file_reference] and others
        thumb_size: JSON.stringify(message.media.photo.sizes.find(size => size._ == 'photoSizeProgressive'))
    },
    offset: 0,
    limit: 1024 * 1024
})
1

There are 1 best solutions below

0
On BEST ANSWER

https://core.telegram.org/constructor/inputPhotoFileLocation
You must pass type from message.media.photo.sizes in the thumb_size field

That is, instead of JSON.stringify(message.media.photo.sizes.find(size => size._ == 'photoSizeProgressive')) you need to specify message.media.photo.sizes.find(size => size._ == 'photoSizeProgressive').type