Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,3 +302,4 @@ helpful and collaborative way.
[slack-community]: https://slackcommunity.com/
[files_upload_v2]: https://github.com/slackapi/python-slack-sdk/releases/tag/v3.19.0
[aiohttp]: https://aiohttp.readthedocs.io/

4 changes: 2 additions & 2 deletions slack_sdk/web/internal_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,11 +345,11 @@ def _to_v2_file_upload_item(upload_file: Dict[str, Any]) -> Dict[str, Optional[A
if filename is None:
# use the local filename if filename is missing
if isinstance(file, (str, os.PathLike)):
filename = os.fspath(file).split(os.path.sep)[-1]
filename = os.path.basename(os.fspath(file))
else:
filename = "Uploaded file"

title = upload_file.get("title", "Uploaded file")
title = upload_file.get("title")
if data is None:
raise SlackRequestError(f"File content not found for filename: {filename}, title: {title}")

Expand Down