Error 400 after successful file upload
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện thao tác upload được nêu trong issue với msgraph-sdk-python 1.17.0, tập trung vào LargeFileUploadTask.upload() và APIError 400 được báo cáo. Kiểm tra kết quả upload và việc xử lý lỗi xung quanh request để xác định tại sao upload thành công vẫn tạo ra một exception. Công việc được xem là hoàn tất khi hành vi này được giải thích và SDK báo cáo kết quả phù hợp hoặc ghi lại workaround cần thiết.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
I'm testing an upload process, here's an anonymized snippet of the code:
async def _upload_file(self, drive_id, filename, file_content, folder_name=None):
properties = DriveItemUploadableProperties(
additional_data={
"@microsoft.graph.conflictBehavior" : "replace",
},
)
request_body = CreateUploadSessionPostRequestBody(item=properties)
if folder_name is not None:
filename = folder_name + '/' + filename
session = await (
self.client
.drives.by_drive_id(drive_id)
.items.by_drive_item_id(f"root:/{filename}:")
.create_upload_session.post(body=request_body)
)
large_file_session = LargeFileUploadSession(
upload_url=session.upload_url,
expiration_date_time=session.expiration_date_time,
additional_data=session.additional_data,
is_cancelled=False,
next_expected_ranges=session.next_expected_ranges
)
task = LargeFileUploadTask(upload_session=large_file_session, request_adapter=self.client.request_adapter, stream=file_content)
upload_result = await task.upload()
return upload_result
The upload proceeds as expected, but I get the following exception anyway:
APIError
Code: 400
message: The server returned an unexpected status code and no error class is registered for this code 400
Expected behavior
Either a more clear error code if there is a problem I'm not seeing, or no error after a successful upload.
How to reproduce
See code in first section.
SDK Version
1.17.0
Latest version known to work for scenario above?
No response
Known Workarounds
Ignoring the exception for error 400 works, but is not ideal.
Debug output
APIError
Code: 400
message: The server returned an unexpected status code and no error class is registered for this code 400
Configuration
Windows 11, x64. I haven't tested on any other systems at present.
Other information
This may not be related to the SDK at all, but if it is an error in the request that isn't clear from the documentation I've read on this. I will echo comments elsewhere that the documentation on using the SDK for uploads is extremely limited and I had to cobble a lot of this together from responses to other questions here.
- Ngôn ngữ chính
- Python
- Star
- 634
- Fork
- 100
- Merge trung bình
- 23 giờ 18 phút
- Pull request đã merge (30 ngày)
- 7
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoftgraph/msgraph-sdk-python
-
status:waiting-for-triage type:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
microsoftgraph/msgraph-sdk-python#1628 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
status:waiting-for-triage type:bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
microsoftgraph/msgraph-sdk-python#1570 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
status:waiting-for-triage type:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
microsoftgraph/msgraph-sdk-python#1563 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
kiota-dom-export.txt is large and included in the released packageCó thể đã có người làm @Fryguy đã nhận 185 ngày trước. Đang mởNeeds: Attention :wave: type:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
microsoftgraph/msgraph-sdk-python#1287 · 3 bình luận · 2 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
status:waiting-for-triage type:feature
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
microsoftgraph/msgraph-sdk-python#1596 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của microsoftgraph/msgraph-sdk-python
Issue tương tự
-
tests
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Plugin] 群聊记忆 · 人格养成Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 74/100
-
bug maintainer-managed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
awslabs/visual-asset-management-system#1759 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100