From 394ab4498506c0be05d1336ee768cfa0b6959905 Mon Sep 17 00:00:00 2001 From: Akkuman Date: Mon, 8 Apr 2024 09:05:11 +0800 Subject: [PATCH] fix: fixed #375 upload image --- notion/block.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/notion/block.py b/notion/block.py index f19784f9..5c402205 100644 --- a/notion/block.py +++ b/notion/block.py @@ -640,7 +640,16 @@ def upload_file(self, path): data = self._client.post( "getUploadFileUrl", - {"bucket": "secure", "name": filename, "contentType": mimetype}, + { + "bucket": "secure", + "name": filename, + "contentType": mimetype, + "record": { + "table": "block", + "id": self.id, + "spaceId": self.space_info['spaceId'], + } + }, ).json() with open(path, "rb") as f: @@ -651,7 +660,6 @@ def upload_file(self, path): self.display_source = data["url"] self.source = data["url"] - self.file_id = data["url"][len(S3_URL_PREFIX) :].split("/")[0] class VideoBlock(EmbedOrUploadBlock):