You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by va...@apache.org on 2025/03/11 21:42:25 UTC
(superset) branch master updated: fix(Slack V2): Specify the filename for the Slack upload method (#32599)
This is an automated email from the ASF dual-hosted git repository.
vavila pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 8e021b0c82 fix(Slack V2): Specify the filename for the Slack upload method (#32599)
8e021b0c82 is described below
commit 8e021b0c8221f8ab22b2a40289c1c96ecbd5a1b2
Author: Vitor Avila <96...@users.noreply.github.com>
AuthorDate: Tue Mar 11 18:42:17 2025 -0300
fix(Slack V2): Specify the filename for the Slack upload method (#32599)
---
superset/reports/notifications/slackv2.py | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/superset/reports/notifications/slackv2.py b/superset/reports/notifications/slackv2.py
index 19b5d98e00..4f4cf84302 100644
--- a/superset/reports/notifications/slackv2.py
+++ b/superset/reports/notifications/slackv2.py
@@ -68,14 +68,14 @@ class SlackV2Notification(SlackMixin, BaseNotification): # pylint: disable=too-
def _get_inline_files(
self,
- ) -> Sequence[Union[str, IOBase, bytes]]:
+ ) -> tuple[Union[str, None], Sequence[Union[str, IOBase, bytes]]]:
if self._content.csv:
- return [self._content.csv]
+ return ("csv", [self._content.csv])
if self._content.screenshots:
- return self._content.screenshots
+ return ("png", self._content.screenshots)
if self._content.pdf:
- return [self._content.pdf]
- return []
+ return ("pdf", [self._content.pdf])
+ return (None, [])
@backoff.on_exception(backoff.expo, SlackApiError, factor=10, base=2, max_tries=5)
@statsd_gauge("reports.slack.send")
@@ -91,7 +91,8 @@ class SlackV2Notification(SlackMixin, BaseNotification): # pylint: disable=too-
if not channels:
raise NotificationParamException("No recipients saved in the report")
- files = self._get_inline_files()
+ file_type, files = self._get_inline_files()
+ file_name = f"{title}.{file_type}"
# files_upload returns SlackResponse as we run it in sync mode.
for channel in channels:
@@ -102,6 +103,7 @@ class SlackV2Notification(SlackMixin, BaseNotification): # pylint: disable=too-
file=file,
initial_comment=body,
title=title,
+ filename=file_name,
)
else:
client.chat_postMessage(channel=channel, text=body)