feat: enhance OneDrive file creation by converting markdown to DOCX format and updating client to handle byte content

This commit is contained in:
Anish Sarkar 2026-03-29 05:02:08 +05:30
parent dc034a98eb
commit 8035eb9749
3 changed files with 50 additions and 6 deletions

View file

@ -224,12 +224,15 @@ class OneDriveClient:
self,
name: str,
parent_id: str | None = None,
content: str | None = None,
content: str | bytes | None = None,
mime_type: str | None = None,
) -> dict[str, Any]:
"""Create (upload) a file in OneDrive."""
folder_path = f"/me/drive/items/{parent_id or 'root'}"
body = (content or "").encode("utf-8")
if isinstance(content, bytes):
body = content
else:
body = (content or "").encode("utf-8")
resp = await self._request(
"PUT",
f"{folder_path}:/{name}:/content",