Skip to content

Commit

Permalink
Add public access to container.
Browse files Browse the repository at this point in the history
  • Loading branch information
sjkp committed Jan 7, 2019
1 parent 8337f33 commit d67758e
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ private async Task<CloudBlockBlob> GetBlob(HttpChallenge challenge)
var client = storageAccount.CreateCloudBlobClient();
var container = client.GetContainerReference(containerName);
await container.CreateIfNotExistsAsync();
if (!"$web".Equals(containerName, StringComparison.InvariantCultureIgnoreCase) && container.Properties.PublicAccess != BlobContainerPublicAccessType.Blob)
{
await container.SetPermissionsAsync(new BlobContainerPermissions()
{
PublicAccess = BlobContainerPublicAccessType.Blob
});
}
// We need to strip off any leading '/' in the path
var filePath = challenge.FilePath;
if (filePath.StartsWith("/", StringComparison.OrdinalIgnoreCase))
Expand Down

0 comments on commit d67758e

Please sign in to comment.