Skip to content

Commit 18f4e24

Browse files
committed
fix: use getattr for IOBase.name to satisfy type checker
1 parent 7afd588 commit 18f4e24

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

office365/onedrive/driveitems/driveItem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ def _modify_query(request: RequestOptions) -> None:
388388
def upload_file(self, path_or_file: str | PathLike | IOBase) -> DriveItem:
389389
"""Uploads a file (up to ~4MB; use resumable_upload for larger files)."""
390390
if isinstance(path_or_file, IOBase):
391-
return self.upload(os.path.basename(path_or_file.name), path_or_file.read())
391+
return self.upload(os.path.basename(getattr(path_or_file, "name", "")), path_or_file.read())
392392
with open(path_or_file, "rb") as f:
393393
return self.upload(os.path.basename(str(path_or_file)), f.read())
394394

0 commit comments

Comments
 (0)