fix: avoid Slack file upload API for fallback messages (#10461)

Skip calling the Slack file upload API for message types such as
fallback (e.g., Facebook and location messages) that lack actual file
data in attachments. This prevents unnecessary API calls and resolves a
Sentry error currently occurring in production.

fixes: https://github.com/chatwoot/chatwoot/issues/10460
This commit is contained in:
Sojan Jose
2024-11-26 12:56:40 +08:00
committed by GitHub
parent b9d888d8ab
commit 12a82b6459
4 changed files with 43 additions and 2 deletions

View File

@@ -117,6 +117,8 @@ class Integrations::Slack::SendOnSlackService < Base::SendOnChannelService
end
def upload_file
return unless message.attachments.first.with_attached_file?
result = slack_client.files_upload({
channels: hook.reference_id,
initial_comment: 'Attached File!',