@@ -614,6 +614,27 @@ await RetryAsync(
614614 _retryStageBlockFromUri ) ;
615615 }
616616
617+ [ RecordedTest ]
618+ [ ServiceVersion ( Min = BlobClientOptions . ServiceVersion . V2024_08_04 ) ]
619+ public async Task StageBlobFromUriAsync_SourceErrorAndStatusCode ( )
620+ {
621+ // Arrange
622+ var constants = TestConstants . Create ( this ) ;
623+ await using DisposingContainer test = await GetTestContainerAsync ( publicAccessType : PublicAccessType . None ) ;
624+ BlockBlobClient sourceBlob = InstrumentClient ( test . Container . GetBlockBlobClient ( GetNewBlobName ( ) ) ) ;
625+ BlockBlobClient destBlob = InstrumentClient ( test . Container . GetBlockBlobClient ( GetNewBlobName ( ) ) ) ;
626+
627+ // Act
628+ await TestHelper . AssertExpectedExceptionAsync < RequestFailedException > (
629+ destBlob . StageBlockFromUriAsync ( sourceBlob . Uri , ToBase64 ( GetNewBlockName ( ) ) ) ,
630+ e =>
631+ {
632+ Assert . IsTrue ( e . Message . Contains ( "CopySourceStatusCode: 409" ) ) ;
633+ Assert . IsTrue ( e . Message . Contains ( "CopySourceErrorCode: PublicAccessNotPermitted" ) ) ;
634+ Assert . IsTrue ( e . Message . Contains ( "CopySourceErrorMessage: Public access is not permitted on this storage account." ) ) ;
635+ } ) ;
636+ }
637+
617638 [ RecordedTest ]
618639 [ TestCase ( nameof ( BlobRequestConditions . IfModifiedSince ) ) ]
619640 [ TestCase ( nameof ( BlobRequestConditions . IfUnmodifiedSince ) ) ]
@@ -2821,6 +2842,27 @@ await TestHelper.AssertExpectedExceptionAsync<RequestFailedException>(
28212842 e => Assert . AreEqual ( BlobErrorCode . CannotVerifyCopySource . ToString ( ) , e . ErrorCode ) ) ;
28222843 }
28232844
2845+ [ RecordedTest ]
2846+ [ ServiceVersion ( Min = BlobClientOptions . ServiceVersion . V2024_08_04 ) ]
2847+ public async Task SyncUploadFromUriAsync_SourceErrorAndStatusCode ( )
2848+ {
2849+ // Arrange
2850+ var constants = TestConstants . Create ( this ) ;
2851+ await using DisposingContainer test = await GetTestContainerAsync ( publicAccessType : PublicAccessType . None ) ;
2852+ BlockBlobClient sourceBlob = InstrumentClient ( test . Container . GetBlockBlobClient ( GetNewBlobName ( ) ) ) ;
2853+ BlockBlobClient destBlob = InstrumentClient ( test . Container . GetBlockBlobClient ( GetNewBlobName ( ) ) ) ;
2854+
2855+ // Act
2856+ await TestHelper . AssertExpectedExceptionAsync < RequestFailedException > (
2857+ destBlob . SyncUploadFromUriAsync ( sourceBlob . Uri ) ,
2858+ e =>
2859+ {
2860+ Assert . IsTrue ( e . Message . Contains ( "CopySourceStatusCode: 409" ) ) ;
2861+ Assert . IsTrue ( e . Message . Contains ( "CopySourceErrorCode: PublicAccessNotPermitted" ) ) ;
2862+ Assert . IsTrue ( e . Message . Contains ( "CopySourceErrorMessage: Public access is not permitted on this storage account." ) ) ;
2863+ } ) ;
2864+ }
2865+
28242866 [ RecordedTest ]
28252867 [ ServiceVersion ( Min = BlobClientOptions . ServiceVersion . V2020_04_08 ) ]
28262868 public async Task SyncUploadFromUriAsync_OverwriteSourceBlobProperties ( )
0 commit comments