This is an automated email from the ASF dual-hosted git repository. michaelsmolina pushed a commit to branch 5.0 in repository https://gitbox.apache.org/repos/asf/superset.git
commit bdb9f4804400c86fea65b17788402a811e5cc8c7 Author: Vitor Avila <[email protected]> AuthorDate: Tue Mar 11 18:42:17 2025 -0300 fix(Slack V2): Specify the filename for the Slack upload method (#32599) (cherry picked from commit 8e021b0c8221f8ab22b2a40289c1c96ecbd5a1b2) --- 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)
