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:
@@ -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!',
|
||||
|
||||
Reference in New Issue
Block a user