Skip to content

Commit 4f3dcbc

Browse files
committed
Added a check when forbidden is returned when validating if a key exists in a S3 Bucket.
1 parent 2b1450d commit 4f3dcbc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/ImageSharp.Web.Providers.AWS/Providers/AWSS3StorageImageProvider.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,12 @@ private async Task<bool> KeyExists(IAmazonS3 s3Client, string bucketName, string
161161
return false;
162162
}
163163

164+
// If the object exists but the client is not authorized to access it, then a "Forbidden" will be thrown.
165+
if (string.Equals(e.ErrorCode, "Forbidden"))
166+
{
167+
return false;
168+
}
169+
164170
throw;
165171
}
166172
}

0 commit comments

Comments
 (0)