nanxiuzi commented on code in PR #17689:
URL: 
https://github.com/apache/dolphinscheduler/pull/17689#discussion_r2584526268


##########
dolphinscheduler-storage-plugin/dolphinscheduler-storage-oss/src/main/java/org/apache/dolphinscheduler/plugin/storage/oss/OssStorageOperator.java:
##########
@@ -255,14 +255,21 @@ public List<StorageEntity> listStorageEntity(String 
resourceAbsolutePath) {
                 .withPrefix(ossResourceAbsolutePath);
 
         ListObjectsV2Result listObjectsV2Result = 
ossClient.listObjectsV2(listObjectsV2Request);
+
+        // Collect common prefixes (directories)
+        Set<String> commonPrefixSet = new 
HashSet<>(listObjectsV2Result.getCommonPrefixes());
+
         List<StorageEntity> storageEntities = new ArrayList<>();
         storageEntities.addAll(listObjectsV2Result.getCommonPrefixes()
                 .stream()
                 .map(this::transformCommonPrefixToStorageEntity)
                 .collect(Collectors.toList()));
         storageEntities.addAll(
                 listObjectsV2Result.getObjectSummaries().stream()
-                        .filter(s3ObjectSummary -> 
!s3ObjectSummary.getKey().equals(resourceAbsolutePath))
+                        // Filter out the current directory itself
+                        .filter(s3ObjectSummary -> 
!s3ObjectSummary.getKey().equals(ossResourceAbsolutePath))
+                        // Filter out directory marker objects that are 
already in commonPrefixes
+                        .filter(s3ObjectSummary -> 
!commonPrefixSet.contains(s3ObjectSummary.getKey()))

Review Comment:
   Resubmitted



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to