This is an automated email from the ASF dual-hosted git repository.
zihaoxiang pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new 45a3c8b9d8 [Fix-17688] Resource validation error and duplicate folders
when using Aliyun OSS storage (#17689)
45a3c8b9d8 is described below
commit 45a3c8b9d8d5be655f7496c44bed362cb0c14a8e
Author: huangrunxing <[email protected]>
AuthorDate: Thu Dec 4 09:33:31 2025 +0800
[Fix-17688] Resource validation error and duplicate folders when using
Aliyun OSS storage (#17689)
---
.../plugin/storage/oss/OssStorageOperator.java | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git
a/dolphinscheduler-storage-plugin/dolphinscheduler-storage-oss/src/main/java/org/apache/dolphinscheduler/plugin/storage/oss/OssStorageOperator.java
b/dolphinscheduler-storage-plugin/dolphinscheduler-storage-oss/src/main/java/org/apache/dolphinscheduler/plugin/storage/oss/OssStorageOperator.java
index e551e5d09f..dd4c404e20 100644
---
a/dolphinscheduler-storage-plugin/dolphinscheduler-storage-oss/src/main/java/org/apache/dolphinscheduler/plugin/storage/oss/OssStorageOperator.java
+++
b/dolphinscheduler-storage-plugin/dolphinscheduler-storage-oss/src/main/java/org/apache/dolphinscheduler/plugin/storage/oss/OssStorageOperator.java
@@ -255,6 +255,10 @@ public class OssStorageOperator extends
AbstractStorageOperator implements Close
.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()
@@ -262,7 +266,10 @@ public class OssStorageOperator extends
AbstractStorageOperator implements Close
.collect(Collectors.toList()));
storageEntities.addAll(
listObjectsV2Result.getObjectSummaries().stream()
- .filter(s3ObjectSummary ->
!s3ObjectSummary.getKey().equals(resourceAbsolutePath))
+ // Filter out the current directory itself
+ .filter(ossObjectSummary ->
!ossObjectSummary.getKey().equals(ossResourceAbsolutePath))
+ // Filter out directory marker objects that are
already in commonPrefixes
+ .filter(ossObjectSummary ->
!commonPrefixSet.contains(ossObjectSummary.getKey()))
.map(this::transformOSSObjectToStorageEntity)
.collect(Collectors.toList()));
@@ -363,11 +370,13 @@ public class OssStorageOperator extends
AbstractStorageOperator implements Close
StorageEntity entity = new StorageEntity();
entity.setFileName(new File(absolutePath).getName());
entity.setFullName(absolutePath);
+ entity.setPfullName(resourceMetaData.getResourceParentAbsolutePath());
entity.setDirectory(resourceMetaData.isDirectory());
entity.setType(resourceMetaData.getResourceType());
entity.setSize(0L);
entity.setCreateTime(null);
entity.setUpdateTime(null);
+ entity.setRelativePath(resourceMetaData.getResourceRelativePath());
return entity;
}