github-actions[bot] commented on issue #17177:
URL: 
https://github.com/apache/dolphinscheduler/issues/17177#issuecomment-2876550901

   ### 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 configure cos as the resource backend. After uploading files and creating 
folders, you can see that the creation has been successfully done on 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)
   
   But it still shows empty on ds
   > But it still shows as empty on ds
   
   
![Image](https://github.com/user-attachments/assets/38ba9aa5-1d5f-4c49-bcef-339147279438)
   
   The reason is that transformCOSKeyToAbsolutePath will remove the last `/`. I 
don't understand why I should do this, but the cos API requires the last `/` to 
have `/`.
   > 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)
   
   After modifying the following code, you can recover
   > Modify the following code to restore
   ```
      if (!path.endsWith(File.separator)) {
               path = path + File.separator;
           }
           String resourceAbsolutePath = path;
   ```
   But there will be another problem like this, that is, the folder will not be 
displayed. The reason is that only `result.getObjectSummaries()` is called. 
This will get the file list of the current directory, but the folder 
information is in `result.getCommonPrefixes()`
   Need to add the following code
   > 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())
   ```
   Then it will be normal
   > 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