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

Empty streams are not supported #801

Open
zibizz1 opened this issue Jul 7, 2023 · 4 comments
Open

Empty streams are not supported #801

zibizz1 opened this issue Jul 7, 2023 · 4 comments

Comments

@zibizz1
Copy link

zibizz1 commented Jul 7, 2023

if (ObjectStreamData is not null && ObjectSize == 0)

I would like to upload empty file but providing streams and 0 object size results in exception.

Maybe object size should be "long?" type or different way should be used to check if object Size was set (other than comparing with 0)

@Lukas-EyeC
Copy link

I have the same issue right now

@fissssssh
Copy link

same problem when I want to create a directory like some_directory/

@Lukas-EyeC
Copy link

Lukas-EyeC commented Sep 3, 2024

My workaround for the empty file was:

if( data.Length == 0 )
{
	var tempFileName = Path.GetTempFileName();
	await m_minio.PutObjectAsync(
		new PutObjectArgs().WithBucket( key.Bucket ).WithObject( key.Key ).WithFileName( tempFileName ) );
	return;
}

@fissssssh
Copy link

My workaround for the empty file was:

if( data.Length == 0 )
{
	var tempFileName = Path.GetTempFileName();
	await m_minio.PutObjectAsync(
		new PutObjectArgs().WithBucket( key.Bucket ).WithObject( key.Key ).WithFileName( tempFileName ) );
	return;
}

#612 I think this PR is not reasonable. The ObjectSize should be defined as a long? type, and it should be checked for null rather than 0.

I tried using your method, and it worked. Thank you.

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

No branches or pull requests

3 participants