Skip to content

Commit 4f107ac

Browse files
committed
Reorganise check for empty path
1 parent 7a4796b commit 4f107ac

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/UmbracoFileSystemProviders.Azure/AzureFileSystem.cs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -784,12 +784,17 @@ private CloudBlockBlob GetBlockBlobReference(string path)
784784

785785
string blobPath = this.FixPath(path);
786786

787+
// Only make the request if there is an actual path. See issue 8.
788+
// https://github.com/JimBobSquarePants/UmbracoFileSystemProviders.Azure/issues/8
789+
if (string.IsNullOrWhiteSpace(path))
790+
{
791+
return null;
792+
}
793+
787794
try
788795
{
789796
var blobReference = this.cloudBlobContainer.GetBlobReferenceFromServer(blobPath);
790-
// Only make the request if there is an actual path. See issue 8.
791-
// https://github.com/JimBobSquarePants/UmbracoFileSystemProviders.Azure/issues/8
792-
if (blobReference.BlobType == BlobType.BlockBlob && !string.IsNullOrWhiteSpace(path))
797+
if (blobReference.BlobType == BlobType.BlockBlob)
793798
{
794799
return blobReference as CloudBlockBlob;
795800
}
@@ -804,14 +809,8 @@ private CloudBlockBlob GetBlockBlobReference(string path)
804809
{
805810
// blob doesn't exist yet
806811
var blobReference = this.cloudBlobContainer.GetBlockBlobReference(blobPath);
807-
if (!string.IsNullOrWhiteSpace(path))
808-
{
809-
return blobReference;
810-
}
811-
else
812-
{
813-
return null;
814-
}
812+
return blobReference;
813+
815814
}
816815
catch (StorageException ex)
817816
{

0 commit comments

Comments
 (0)