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

fixes the regression on BucketExistsAsync #1106

Merged
merged 5 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions Minio/ApiEndpoints/BucketOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,6 @@ await this.ExecuteTaskAsync(ResponseErrorHandlers, requestMessageBuilder,
HttpStatusCode.NotFound != ice.ServerResponse.StatusCode) &&
ice.ServerResponse is not null;
}
catch (Exception ex)
{
if (ex.GetType() == typeof(BucketNotFoundException)) return false;
throw;
}
ebozduman marked this conversation as resolved.
Show resolved Hide resolved
}

/// <summary>
Expand Down
11 changes: 6 additions & 5 deletions Minio/RequestExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ await requestMessageBuilder.ResponseWriter(responseResult.ContentStream, cancell
if (request.Method == HttpMethod.Head)
{
if (responseResult.Exception?.GetType().Equals(typeof(BucketNotFoundException)) == true ||
path.Length == 1)
path.ToList().Count == 1)
ebozduman marked this conversation as resolved.
Show resolved Hide resolved
responseResult.Exception = new BucketNotFoundException();

if (path.Length > 1)
if (path.ToList().Count > 1)
ebozduman marked this conversation as resolved.
Show resolved Hide resolved
{
var found = await minioClient
.BucketExistsAsync(new BucketExistsArgs().WithBucket(path.ToList()[0]), cancellationToken)
Expand All @@ -125,7 +125,11 @@ await requestMessageBuilder.ResponseWriter(responseResult.ContentStream, cancell
if (request.RequestUri.ToString().Contains("lock", StringComparison.OrdinalIgnoreCase) &&
request.Method == HttpMethod.Get)
responseResult.Exception = new MissingObjectLockConfigurationException();
return responseResult;
ramondeklein marked this conversation as resolved.
Show resolved Hide resolved
}

minioClient.HandleIfErrorResponse(responseResult, errorHandlers, startTime);
return responseResult;
}
catch (Exception ex) when (ex is not (OperationCanceledException or
ObjectNotFoundException))
Expand All @@ -139,9 +143,6 @@ await requestMessageBuilder.ResponseWriter(responseResult.ContentStream, cancell
responseResult = new ResponseResult(request, ex);
return responseResult;
}

minioClient.HandleIfErrorResponse(responseResult, errorHandlers, startTime);
return responseResult;
}

private static Task<ResponseResult> ExecuteWithRetry(this IMinioClient minioClient,
Expand Down
Loading