Skip to content
Merged
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
4 changes: 2 additions & 2 deletions slack_sdk/web/internal_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,12 @@ def _to_v2_file_upload_item(upload_file: Dict[str, Any]) -> Dict[str, Optional[A
else:
data = file
elif content is not None:
if isinstance(content, str): # filepath
if isinstance(content, str):
data = content.encode("utf-8")
elif isinstance(content, bytes):
data = content
else:
raise SlackRequestError("The given content must be either filepath as str or data as bytes")
raise SlackRequestError("content for file upload must be 'str' (UTF-8 encoded) or 'bytes' (for data)")

filename = upload_file.get("filename")
if upload_file.get("filename") is None and isinstance(file, str):
Expand Down