-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When uploading file using LargeFileUploadTask (streaming and not in one part) the file getting corrupted in the SharePoint server #2257
Comments
Thanks for reporting this @ihudedi. Would you mind sharing the result of some checks here? This will validate that the number of bytes uploaded is equal to the number of bytes in the file & just to validate contents are similar using a checksum? // Calculate checksum before upload
String uploadFileChecksum = DigestUtils.md5Hex(fileContent);
// You might need to rewind the file content stream/open a new stream with the same file path here
// we'll validate the checksum of the local file matches the one of the uploaded file after the large file upload
// Create your upload session & execute large file upload task
// ...
// After getting uploadResult...
// Use the drive item ID in the uploadResult to fetch the uploaded file
DriveItem uploadedFile = graphServiceClient.drives()
.byDriveId(driveId)
.items()
.byDriveItemId(uploadResult.itemResponse.getId())
.get();
assertEquals(fileSize, uploadedFile.getSize());
InputStream downloadedFile = graphServiceClient.drives()
.byDriveId(driveId)
.items()
.byDriveItemId(uploadResult.itemResponse.getId())
.content()
.get();
assertEquals(uploadFileChecksum, DigestUtils.md5Hex(downloadedFile)); |
Hi @Ndiritu |
@ihudedi thanks for letting me know. I will need to create some test files and validate this. |
Hi @Ndiritu |
Thanks for clarifying @ihudedi. |
Hi @Ndiritu The zip file contains the file befroe the upload and after upload |
Hi @Ndiritu |
Describe the bug
I am using latest version of graph api - 6.24.0
When I uploading any file using
graphServiceClient.drives().byDriveId(driveId).items().byDriveItemId(getDriveItemIdFromRootPath(filePath)).content().put(fileContent) file is uploading correct.
When I upload via the LargeUploadTask - file is corrupted for any file such as MSOffice file or dat file or jar file.
For MSOffice the file can't be opened and for the dat file null values are being inserted to the file.
The code that I am using for the uploading in streaming is:
LargeFileUploadTask largeFileUploadTask = null;
IProgressCallback callback = null;
UploadResult uploadResult = null;
try {
int spoPartSize = 5242880;
Thanks,
Itay
Expected behavior
File should uploaded corrdct with same bytes and noit being corrupted.
How to reproduce
Uploading file using LargeFileUploadTask
SDK Version
6.24/0
Latest version known to work for scenario above?
No response
Known Workarounds
No response
Debug output
Click to expand log
```The text was updated successfully, but these errors were encountered: