File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
src/UmbracoFileSystemProviders.Azure Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -615,8 +615,20 @@ private static CloudBlobContainer CreateContainer(CloudBlobClient cloudBlobClien
615615 }
616616
617617 CloudBlobContainer container = cloudBlobClient . GetContainerReference ( containerName . ToLowerInvariant ( ) ) ;
618- container . CreateIfNotExists ( ) ;
619- container . SetPermissions ( new BlobContainerPermissions { PublicAccess = accessType } ) ;
618+ if ( ! cloudBlobClient . Credentials . IsSAS )
619+ {
620+ // Shared access signatures (SAS) have some limitations compared to shared access keys
621+ // read more on: https://docs.microsoft.com/en-us/azure/storage/common/storage-dotnet-shared-access-signature-part-1
622+ string [ ] sasTokenProperties = cloudBlobClient . Credentials . SASToken . Split ( "&" . ToCharArray ( ) , StringSplitOptions . RemoveEmptyEntries ) ;
623+ bool isAccountSas = sasTokenProperties . Where ( k => k . ToLowerInvariant ( ) . StartsWith ( "si=" ) ) . FirstOrDefault ( ) == null ;
624+ if ( isAccountSas )
625+ {
626+ container . CreateIfNotExists ( ) ;
627+ }
628+
629+ container . SetPermissions ( new BlobContainerPermissions { PublicAccess = accessType } ) ;
630+ }
631+
620632 return container ;
621633 }
622634
You can’t perform that action at this time.
0 commit comments