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

GetObjectAsync.WithOffsetAndLength leads to an error if offset = 0 #629

Closed
And1Kl1 opened this issue May 10, 2022 · 0 comments · Fixed by #646
Closed

GetObjectAsync.WithOffsetAndLength leads to an error if offset = 0 #629

And1Kl1 opened this issue May 10, 2022 · 0 comments · Fixed by #646
Assignees

Comments

@And1Kl1
Copy link

And1Kl1 commented May 10, 2022

I tried to stream a file partial. For this I use the function "GetObjectAsync.WithOffsetAndLength". When calling the method with offset != 0 the call works as expected. As soon as I call the method with offset = 0 the file is not returned from the beginning.
For this I use this code:

using MemoryStream memoryStream = new MemoryStream();
var args = new GetObjectArgs()
                    .WithBucket(_bucketName)
                    .WithObject(path)
                    .WithOffsetAndLength(0, 5)
                    .WithCallbackStream((stream) =>
                    {
                        stream.CopyTo(memoryStream);
                        stream.Dispose();
                    });

                await _minioClient.GetObjectAsync(args);

byte[] bytes = new byte[5];
memoryStream.Read(bytes, 0, 5);

The file I'm reading in contains this data:

hex 
31 32 33 34 35 36 37 38 39 -> 123456789 

I expected the following data to be read:

hex 
31 32 33 34 35 -> 12345 

Instead, the following data was read:

hex 
36 37 38 39 00-> 6789- 

image

ebozduman added a commit to ebozduman/minio-dotnet that referenced this issue May 31, 2022
harshavardhana pushed a commit that referenced this issue Jun 3, 2022
- Fixes #629 GetObject offset=0 problem
- To resolve build issue on Windows
- fix for the windows build issue
- Forgotten regitlint format fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants