stijn192 commented on a change in pull request #4430:
URL: https://github.com/apache/nifi/pull/4430#discussion_r475587981



##########
File path: 
nifi-nar-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/storage/ListAzureBlobStorage.java
##########
@@ -176,45 +174,38 @@ protected String getDefaultTimePrecision() {
     protected List<BlobInfo> performListing(final ProcessContext context, 
final Long minTimestamp) throws IOException {
         String containerName = 
context.getProperty(AzureStorageUtils.CONTAINER).evaluateAttributeExpressions().getValue();
         String prefix = 
context.getProperty(PROP_PREFIX).evaluateAttributeExpressions().getValue();
-        if (prefix == null) {
-            prefix = "";
-        }
+
         final List<BlobInfo> listing = new ArrayList<>();
         try {
-            CloudBlobClient blobClient = 
AzureStorageUtils.createCloudBlobClient(context, getLogger(), null);
-            CloudBlobContainer container = 
blobClient.getContainerReference(containerName);
+            BlobServiceClient blobServiceClient = 
AzureStorageUtils.createBlobServiceClient(context, null);
+            BlobContainerClient blobContainerClient = 
blobServiceClient.getBlobContainerClient(containerName);
 
-            final OperationContext operationContext = new OperationContext();
-            AzureStorageUtils.setProxy(operationContext, context);
+            final ListBlobsOptions listBlobsOptions = new ListBlobsOptions()
+                .setPrefix(prefix)
+                .setDetails(new BlobListDetails()
+                    .setRetrieveMetadata(true));
 
-            for (ListBlobItem blob : container.listBlobs(prefix, true, 
EnumSet.of(BlobListingDetails.METADATA), null, operationContext)) {
-                if (blob instanceof CloudBlob) {
-                    CloudBlob cloudBlob = (CloudBlob) blob;
-                    BlobProperties properties = cloudBlob.getProperties();
-                    StorageUri uri = 
cloudBlob.getSnapshotQualifiedStorageUri();
+            blobContainerClient.listBlobs().forEach(blob -> {
+                if (blob instanceof BlobItem) {
+                    BlobItem blobItem = (BlobItem) blob;
+                    BlobItemProperties properties = blobItem.getProperties();
+                    BlobClient blobClient = 
blobContainerClient.getBlobClient(blobItem.getName());
+                    String uri = blobClient.getBlobUrl();
 
                     Builder builder = new BlobInfo.Builder()
-                                              
.primaryUri(uri.getPrimaryUri().toString())
-                                              .blobName(cloudBlob.getName())
-                                              .containerName(containerName)
+                                              .primaryUri(uri)

Review comment:
       As mentioned in the conversation on `attributes.put("azure.primaryUri", 
blob.getBlobUrl());` - I'm unable to reproduce this error and filename is 
deployed correctly when running the pipeline.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to