minio/minio-dotnet

6.0.1 breaks StatObjectAsync behavior

Tim-Intigriti opened this issue · 4 comments

Previously on v6.0.0 using .StatObjectAsync() would result in an ´ObjectNotFoundException´ if the file was not found. Instead in 6.0.1 this results in an ObjectStat object with null/default values.

Nothing was said about this in release notes so I suspect this isn't expected behavior?

The problem is with this change:
6.0.0...6.0.1#diff-9227c47658c63ef8cd3a54a79ec6e33925e915f5855cdf968257ef89cc6567d0R122

        if (responseResult.StatusCode == HttpStatusCode.NotFound)
        {
            if (request.Method == HttpMethod.Head)
            {
                Exception ex = new BucketNotFoundException();
                responseResult.Exception = ex;
                return responseResult;
            }

            if (request.RequestUri.ToString().Contains("lock", StringComparison.OrdinalIgnoreCase) &&
                request.Method == HttpMethod.Get)
            {
                Exception ex = new MissingObjectLockConfigurationException();
                responseResult.Exception = ex;
                return responseResult;
            }
        }

Those two returns statements does not call minioClient.HandleIfErrorResponse(responseResult, errorHandlers, startTime);

Another problem is (in my case) that the first if shouldn't throw BucketNotFoundException when the bucket exists but the file doesn't.

any update on this?i has the same issue

@pangjianxin

I am looking into it. This is a regression as it was explained above.

@Tim-Intigriti , @pangjianxin , @pgorka86

I've tested and verified the fix, but please reopen if you find that the fix is not good in your env.