microsoftgraph / microsoftgraph/msgraph-sdk-java
LargeFileUploadTask.resume() may update rangesRemaining but does not handle modifying the InputStream accordingly
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Java
- Star
- 444
- Fork
- 154
- Merge trung bình
- 18 giờ 28 phút
- Pull request đã merge (30 ngày)
- 4
Mô tả
Is your feature request related to a problem? Please describe the problem.
I may be misunderstanding something about the SDK but her is my problem.
Im using Android and com.microsoft.graph:microsoft-graph:6.54.0. If I recreate an upload session where the LargeFileUploadTask had uploaded som of the file, and use it to recreate a LargeFileUploadTask and call resume() internally the SDK calls updateSessionStatus() and may update rangesRemaining. However it does not modify my provided InputStream based on this. So when it calls upload() and slices are later created for upload it uses the wrong data and the resulting file is corrupted.
I can not prepare the InputStream because I do not know what rangesRemaining is going to be (hence resume is asking the API) so the only way around it I can see is using updateSessionStatus() myself, adjust the InputStream and call upload() instead.
This works but is what I would assume the resume() function to handle.
Describe the solution you'd like.
It would be good if the resume function could handle the InputStream itself.
If that is not possible maybe provide some way, like a callback in resume(), where I get the new session with potentially new rangesRemaining and can modify my InputStream before the internal upload() call.
Or provide more information in the javadoc so future users do not run into the same wrong assumptions about InputStream handling I did.
Or remove/hide resume() removing the temptation to use it. It seams dangerous for it to ask the API for a new correct range with no way for the developer to act on it before uploading starts.
Additional context?
No response
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.
Hướng nghiên cứu
Bắt đầu bằng cách xác định LargeFileUploadTask.resume(), updateSessionStatus() và upload(), sau đó theo dõi cách rangesRemaining và InputStream được cung cấp được sử dụng sau khi một phiên tải lên được tạo lại được tiếp tục. Tái hiện kịch bản phiên tải lên một phần trên Android hoặc trong một bài kiểm thử tương đương; hoàn tất khi các lượt tải lên được tiếp tục sử dụng đúng vị trí của stream hoặc hiển thị rõ ràng các phạm vi đã cập nhật trước khi tải lên.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java
- Lĩnh vực
- api
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100