Repository navigation
Backlog
Labels
Description
Describe the bug
I'm having some difficulties uploading a large attachment to an email because there's pretty much no documentation but from what I've read in this repo I've tried something like this
Expected behavior
I expect it to upload the file
How to reproduce
request_body = CreateUploadSessionPostRequestBody(
attachment_item=AttachmentItem(
attachment_type=AttachmentType.File,
name=x.filename,
size=x.size,
content_type=x.content_type,
),
)
upload_session = await u.messages.by_message_id(msg.id).attachments.create_upload_session.post(request_body)
large_file_upload_session = LargeFileUploadSession(
upload_url=upload_session.upload_url,
expiration_date_time=datetime.datetime.now(datetime.UTC) + datetime.timedelta(days=1),
additional_data=upload_session.additional_data,
is_cancelled=False,
next_expected_ranges=upload_session.next_expected_ranges
)
file_upload_task = LargeFileUploadTask(
upload_session=large_file_upload_session,
request_adapter=GraphRequestAdapter(AnonymousAuthenticationProvider()), #using client.request_adapter sends the bearer auth header which results in a 401 error
stream=io.BytesIO(x.content),
parsable_factory=FileAttachment
)
await file_upload_task.upload()SDK Version
1.65.0
Latest version known to work for scenario above?
No response
Known Workarounds
No response
Debug output
but I'm getting this error
msgraph_core\tasks\large_file_upload.py:203, in LargeFileUploadTask.last_chunk(self, file, range_start, range_end, parsable_factory)
201 range_parts = self.next_range.split('-') if self.next_range else ['-']
202 start = int(range_parts[0])
--> 203 end = int(range_parts[1]) if len(range_parts) > 1 else 0
204 if start == 0 and end == 0:
205 chunk_data = file.read(self.max_chunk_size)
ValueError: invalid literal for int() with base 10: ''
I've tried to debug it and self.next_range is something like "535313-" so when it's splitted range_parts becomes ["535313", ""]
Configuration
No response
Other information
No response
Activity