fix: Check the file attachment URL exists before downloading attachments in Telegram. (#8679)

In rare cases, the API call to Telegram for the file path fails. We were logging the error in sentry, switching to logs instead.

Co-authored-by: Sojan <sojan@pepalo.com>
This commit is contained in:
Muhsin Keloth
2024-01-12 06:55:46 +05:30
committed by GitHub
parent 1577288843
commit d305c5fd0f
2 changed files with 26 additions and 0 deletions

View File

@@ -100,6 +100,12 @@ class Telegram::IncomingMessageService
def attach_files
return unless file
file_download_path = inbox.channel.get_telegram_file_path(file[:file_id])
if file_download_path.blank?
Rails.logger.info "Telegram file download path is blank for #{file[:file_id]} : inbox_id: #{inbox.id}"
return
end
attachment_file = Down.download(
inbox.channel.get_telegram_file_path(file[:file_id])
)