gaoyan1998 opened a new issue, #17177:
URL: https://github.com/apache/dolphinscheduler/issues/17177

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### What happened
   
   ds配置cos为资源后端,上传文件和创建文件夹后,在cos上可以看到已经创建成功
   > Ds configures cos as the resource backend. After uploading files and 
creating folders, you can see on cos that it has been successfully created.
   
   
![Image](https://github.com/user-attachments/assets/aa627df2-67ac-4816-befa-77826e697454)
   
   但是在ds上面仍然显示为空
   > But it still shows as empty on ds
   
   
![Image](https://github.com/user-attachments/assets/38ba9aa5-1d5f-4c49-bcef-339147279438)
   
   其原因是transformCOSKeyToAbsolutePath会去掉最后一个 `/`,目前不理解为何要这么做,但是cos这个API需要最后一位有 
`/` 才可以
   > The reason for this is that `transformCOSKeyToAbsolutePath `  removes the 
last `/`, I don't understand why this is necessary at the moment, but the cos 
API requires a `/` in the last place for it to work.
   
   
![Image](https://github.com/user-attachments/assets/48a52e70-2440-4610-9233-dbb37023037c)
   
   修改如下代码后可恢复
   > Modify the following code to restore
   ```
      if (!path.endsWith(File.separator)) {
               path = path + File.separator;
           }
           String resourceAbsolutePath = path;
   ```
   
但是这样还会有另一个问题,就是文件夹不会显示,原因是,目前只调用了`result.getObjectSummaries()`这个会获取当前目录的文件列表,但是文件夹信息在`result.getCommonPrefixes()`里面
   需要补上如下代码
   > But there will be another problem in this way, that is, the folder will 
not be displayed, the reason is that currently only'result. 
getObjectSummaries()'this will get a list of files in the current directory, 
but the folder information is in'result. Inside getCommonPrefixes()`
    Need to make up the following code
   ```
   result.getCommonPrefixes()
                   .stream()
                   .filter(x->!resourceAbsolutePath.equals(x))
                   .map(key -> {
                       ObjectMetadata metadata = new ObjectMetadata();
                       COSObject object = new COSObject();
                       object.setObjectMetadata(metadata);
                       object.setKey(key);
                       return transformCOSObjectToStorageEntity(object);
                   }).collect(Collectors.toList())
   ```
   随后即可正常
   > This will be followed by a normal
   
   
![Image](https://github.com/user-attachments/assets/19fbddb6-225e-4416-a4df-a81fe25ef9d1)
   
   
   
   ### What you expected to happen
   
   0
   
   ### How to reproduce
   
   0
   
   ### Anything else
   
   _No response_
   
   ### Version
   
   dev
   
   ### Are you willing to submit PR?
   
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


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