@@ -129,9 +129,9 @@ public AzureStorage(
129129
130130 if ( initializeContainer )
131131 {
132- BlobContainerInfo blobContainerInfo = _blobContainerClientWrapper . ContainerClient . CreateIfNotExists ( PublicAccessType . Blob ) ;
132+ Response < BlobContainerInfo > blobContainerInfoResponse = _blobContainerClientWrapper . ContainerClient . CreateIfNotExists ( PublicAccessType . Blob ) ;
133133
134- if ( blobContainerInfo != null && Verbose )
134+ if ( blobContainerInfoResponse ? . Value != null && Verbose )
135135 {
136136 Trace . WriteLine ( $ "Created '{ _blobContainerClientWrapper . ContainerClient . Name } ' public container") ;
137137 }
@@ -192,10 +192,10 @@ public override async Task<IEnumerable<StorageListItem>> ListAsync(CancellationT
192192 var blobs = new List < StorageListItem > ( ) ;
193193
194194 BlobContainerClient blobContainerClient = _blobContainerClientWrapper . ContainerClient ;
195- await foreach ( var blobItem in blobContainerClient . GetBlobsAsync ( prefix : _directory . DirectoryPrefix , cancellationToken : cancellationToken ) )
195+ await foreach ( var blobItem in blobContainerClient . GetBlobsByHierarchyAsync ( prefix : _directory . DirectoryPrefix , cancellationToken : cancellationToken ) )
196196 {
197- var lastModified = blobItem . Properties . LastModified ? . UtcDateTime ;
198- blobs . Add ( new StorageListItem ( new Uri ( blobContainerClient . Uri , blobItem . Name ) , lastModified ) ) ;
197+ var lastModified = blobItem . Blob . Properties . LastModified ? . UtcDateTime ;
198+ blobs . Add ( new StorageListItem ( blobContainerClient . GetBlobClient ( blobItem . Blob . Name ) . Uri , lastModified ) ) ;
199199 }
200200
201201 return blobs ;
@@ -314,7 +314,7 @@ protected override async Task OnSaveAsync(Uri resourceUri, StorageContent conten
314314
315315 await blockBlobClient . UploadAsync ( destinationStream , headers , conditions : blobRequestConditions , cancellationToken : cancellationToken ) ;
316316
317- Trace . WriteLine ( $ "Saved compressed blob { blockBlobClient . Uri } to container { _blobContainerClientWrapper . ContainerClient . Name } ") ;
317+ Trace . WriteLine ( $ "Saved compressed blob { RemoveQueryString ( blockBlobClient . Uri ) } to container { _blobContainerClientWrapper . ContainerClient . Name } ") ;
318318 }
319319 }
320320 else
@@ -323,7 +323,7 @@ protected override async Task OnSaveAsync(Uri resourceUri, StorageContent conten
323323 {
324324 await blockBlobClient . UploadAsync ( stream , headers , cancellationToken : cancellationToken ) ;
325325
326- Trace . WriteLine ( $ "Saved uncompressed blob { blockBlobClient . Uri } to container { _blobContainerClientWrapper . ContainerClient . Name } ") ;
326+ Trace . WriteLine ( $ "Saved uncompressed blob { RemoveQueryString ( blockBlobClient . Uri ) } to container { _blobContainerClientWrapper . ContainerClient . Name } ") ;
327327 }
328328 }
329329
@@ -351,14 +351,14 @@ private async Task<bool> TryTakeBlobSnapshotAsync(BlockBlobClient blobBlockClien
351351 {
352352 var response = await blobBlockClient . CreateSnapshotAsync ( ) ;
353353 stopwatch . Stop ( ) ;
354- Trace . WriteLine ( $ "SnapshotCreated:milliseconds={ stopwatch . ElapsedMilliseconds } :{ blobBlockClient . Uri . ToString ( ) } :{ response ? . Value . Snapshot } ") ;
354+ Trace . WriteLine ( $ "SnapshotCreated:milliseconds={ stopwatch . ElapsedMilliseconds } :{ RemoveQueryString ( blobBlockClient . Uri ) } :{ response ? . Value . Snapshot } ") ;
355355 }
356356 return true ;
357357 }
358358 catch ( RequestFailedException e )
359359 {
360360 stopwatch . Stop ( ) ;
361- Trace . WriteLine ( $ "EXCEPTION:milliseconds={ stopwatch . ElapsedMilliseconds } :CreateSnapshot: Failed to take the snapshot for blob { blobBlockClient . Uri . ToString ( ) } . Exception{ e . ToString ( ) } ") ;
361+ Trace . WriteLine ( $ "EXCEPTION:milliseconds={ stopwatch . ElapsedMilliseconds } :CreateSnapshot: Failed to take the snapshot for blob { RemoveQueryString ( blobBlockClient . Uri ) } . Exception{ e . ToString ( ) } ") ;
362362 return false ;
363363 }
364364 }
@@ -429,7 +429,7 @@ protected override async Task OnDeleteAsync(Uri resourceUri, DeleteRequestOption
429429
430430 public override Uri GetUri ( string name )
431431 {
432- var baseUri = _directory . Uri . AbsoluteUri ;
432+ var baseUri = RemoveQueryString ( _directory . Uri ) ;
433433
434434 if ( baseUri . EndsWith ( "/" ) )
435435 {
@@ -465,22 +465,22 @@ public async Task<bool> AreSynchronized(ICloudBlockBlob sourceBlockBlob, ICloudB
465465 var destinationBlobHasSha512Hash = destinationBlobMetadata . TryGetValue ( Sha512HashAlgorithmId , out var destinationBlobSha512Hash ) ;
466466 if ( ! sourceBlobHasSha512Hash )
467467 {
468- Trace . TraceWarning ( $ "The source blob ({ sourceBlockBlob . Uri } ) doesn't have the SHA512 hash.") ;
468+ Trace . TraceWarning ( $ "The source blob ({ RemoveQueryString ( sourceBlockBlob . Uri ) } ) doesn't have the SHA512 hash.") ;
469469 }
470470 if ( ! destinationBlobHasSha512Hash )
471471 {
472- Trace . TraceWarning ( $ "The destination blob ({ destinationBlockBlob . Uri } ) doesn't have the SHA512 hash.") ;
472+ Trace . TraceWarning ( $ "The destination blob ({ RemoveQueryString ( destinationBlockBlob . Uri ) } ) doesn't have the SHA512 hash.") ;
473473 }
474474 if ( sourceBlobHasSha512Hash && destinationBlobHasSha512Hash )
475475 {
476476 if ( sourceBlobSha512Hash == destinationBlobSha512Hash )
477477 {
478- Trace . WriteLine ( $ "The source blob ({ sourceBlockBlob . Uri } ) and destination blob ({ destinationBlockBlob . Uri } ) have the same SHA512 hash and are synchronized.") ;
478+ Trace . WriteLine ( $ "The source blob ({ RemoveQueryString ( sourceBlockBlob . Uri ) } ) and destination blob ({ RemoveQueryString ( destinationBlockBlob . Uri ) } ) have the same SHA512 hash and are synchronized.") ;
479479 return true ;
480480 }
481481
482482 // The SHA512 hash between the source and destination blob should be always same.
483- Trace . TraceWarning ( $ "The source blob ({ sourceBlockBlob . Uri } ) and destination blob ({ destinationBlockBlob . Uri } ) have the different SHA512 hash and are not synchronized. " +
483+ Trace . TraceWarning ( $ "The source blob ({ RemoveQueryString ( sourceBlockBlob . Uri ) } ) and destination blob ({ RemoveQueryString ( destinationBlockBlob . Uri ) } ) have the different SHA512 hash and are not synchronized. " +
484484 $ "The source blob hash is { sourceBlobSha512Hash } while the destination blob hash is { destinationBlobSha512Hash } ") ;
485485 }
486486
@@ -524,7 +524,7 @@ public async Task<bool> HasPropertiesAsync(Uri blobUri, string contentType, stri
524524 private BlockBlobClient GetBlockBlobReference ( string blobName )
525525 {
526526 IBlobContainerClientWrapper containerClient = _directory . ContainerClientWrapper ;
527- BlockBlobClient blobClient = containerClient . GetBlockBlobClient ( blobName ) ;
527+ BlockBlobClient blobClient = containerClient . GetBlockBlobClient ( _directory . DirectoryPrefix + "/" + blobName ) ;
528528
529529 // ApplyBlobRequestOptions(blobClient) is not needed as the options should be set at the client level
530530 // when creating the BlobServiceClient or BlobContainerClient.
0 commit comments