Skip to content

Commit 8ba93f1

Browse files
authored
fix: method attach_file() to not read() file content and simply pass to attach_content() (#1535)
1 parent fdaf1ff commit 8ba93f1

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

atlassian/confluence.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,16 +1502,15 @@ def attach_file(
15021502
content_type = self.content_types.get(extension, "application/binary")
15031503

15041504
with open(filename, "rb") as infile:
1505-
content = infile.read()
1506-
return self.attach_content(
1507-
content,
1508-
name,
1509-
content_type,
1510-
page_id=page_id,
1511-
title=title,
1512-
space=space,
1513-
comment=comment,
1514-
)
1505+
return self.attach_content(
1506+
infile,
1507+
name,
1508+
content_type,
1509+
page_id=page_id,
1510+
title=title,
1511+
space=space,
1512+
comment=comment,
1513+
)
15151514

15161515
def download_attachments_from_page(self, page_id, path=None, start=0, limit=50, filename=None, to_memory=False):
15171516
"""

0 commit comments

Comments
 (0)