Skip to content

Commit

Permalink
Replaced call to "bucketExists" with call to "listObjects"
Browse files Browse the repository at this point in the history
  • Loading branch information
JaniruTEC committed Nov 8, 2023
1 parent 6db3a72 commit 46f244f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions data/src/main/java/org/cryptomator/data/cloud/s3/S3Impl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -332,12 +332,11 @@ internal class S3Impl(private val cloud: S3Cloud, private val client: MinioClien
@Throws(NoSuchBucketException::class, BackendException::class)
fun checkAuthentication(): String {
return try {
if (!client.bucketExists(BucketExistsArgs.builder().bucket(cloud.s3Bucket()).build())) {
throw NoSuchBucketException(cloud.s3Bucket())
}
//Throw appropriate exception implicitly through "handleApiError"
client.listObjects(ListObjectsArgs.builder().bucket(cloud.s3Bucket()).maxKeys(1).build())
""
} catch (e: ErrorResponseException) {
throw handleApiError(e, "")
throw handleApiError(e, cloud.s3Bucket())
}
}

Expand Down

0 comments on commit 46f244f

Please sign in to comment.