Skip to content
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 downoading from sharepoint with buffer size always getting maximum 8K buffer and not as we asked #2269

Open
ihudedi opened this issue Jan 8, 2025 · 8 comments
Labels
Needs: Attention 👋 type:question An issue that's a question

Comments

@ihudedi
Copy link

ihudedi commented Jan 8, 2025

Describe the bug

When downloading file from sharepoint using graph api and set the buffer size to be downloaded only 8K ( maximum) is fetched ) instread of the given buffer size.
InputStream inputStream = graphServiceClient.drives().byDriveId(driveId).items().byDriveItemId(getDriveItemIdFromRootPath(filePath)).content().get();
byte[] buf = new byte[cloudPartSizeWhenDownloadingToLocal];
int bytesRead;
while ((bytesRead = srcInputStream.read(buf)) != -1) {
byresRead is always maximum 8K and not per demand
}

Expected behavior

The bytess returned from this method should aline with the request.

How to reproduce

see above

SDK Version

6.25.1

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_
@ihudedi ihudedi added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Jan 8, 2025
@ihudedi
Copy link
Author

ihudedi commented Jan 15, 2025

Hi @Ndiritu
Any updates?
Thanks,
Itay

@Ndiritu
Copy link
Contributor

Ndiritu commented Jan 15, 2025

Hi @ihudedi

To control the number of bytes returned you'd need to download the Drive Item first & pass a Range header to the download URL - docs. The .../content endpoint doesn't support partial downloads

Lmk if you face any more issues.

@Ndiritu Ndiritu added type:question An issue that's a question status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Jan 15, 2025
@ihudedi
Copy link
Author

ihudedi commented Jan 15, 2025

Hi @Ndiritu
I don't want partial download.
SO what you tell me that by default you download only 8K each call?
And how do I download range content via java?
Thanks,
Itay

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 and removed status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close labels Jan 15, 2025
@Ndiritu
Copy link
Contributor

Ndiritu commented Jan 15, 2025

@ihudedi /content should return the entire item. Do you mean that the API is only returning 8Kb of a larger file?
Are you able to validate this using Graph Explorer or a raw HTTP call without the SDK?

You can use the requestConfiguration object to pass custom headers e.g. Range for the partial download

@ihudedi
Copy link
Author

ihudedi commented Jan 15, 2025

Hi @Ndiritu
When using content we get InputStream object.
Trying to read X bytes always return 8K bytes maximum.
I will try the range header to see I I get only the range
Thanks,
Itay

@ihudedi
Copy link
Author

ihudedi commented Jan 21, 2025

Hi @Ndiritu
Issue was resolved.
Thanks,
Itay

@Ndiritu
Copy link
Contributor

Ndiritu commented Jan 23, 2025

Great to hear @ihudedi
Are you able to share what the root cause was for future reference by others?

@ihudedi
Copy link
Author

ihudedi commented Jan 23, 2025

Hi @Ndiritu
The inputStream.read(buf)) always bring only max 8K bytes I used in parallel and fetch the stream in ranges.
Still the read should fetch all the bytes in the buffer not only 8K
Thanks,
Itay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Attention 👋 type:question An issue that's a question
Projects
None yet
Development

No branches or pull requests

2 participants