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

   ### 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
   
   Rename (update) a file will override the filename with the input name(alias) 
that the user submitted
   
   ### What you expected to happen
   
   The filename should not be overridden by name (alias). I have read the 
source code, filename needs to obtain from `MultipartFile#getOriginalFilename` 
method in the `ResourcesServiceImpl#updateResource`,  just like 
`ResourcesServiceImpl#createResource` method.
   
   I'm not sure if this is intended or just a bug, but it's kind of weird to 
me. 
   
   ### How to reproduce
   
   1. Upload a new file `xxx.jar` with the name(alias) `xxx-1.jar`.
   2. Check page response, alias : "xxx-1.jar" filename : "xxx.jar".
   3. Rename `xxx-1.jar` to `xxx-2.jar`.
   4. Check page response, alias : "xxx-2.jar" filename : "xxx-2.jar". 
(Filename override by alias)
   
   
   ### Anything else
   
   This can be fixed easily by changing
   ```
           resource.setAlias(name);
           resource.setFileName(name);
           resource.setFullName(fullName);
           resource.setDescription(desc);
           resource.setUpdateTime(now);
           if (file != null) {
               resource.setSize(file.getSize());
           }
   ```
   
   to
   
   ```
           resource.setAlias(name);
           resource.setFullName(fullName);
           resource.setDescription(desc);
           resource.setUpdateTime(now);
           if (file != null) {
               resource.setSize(file.getSize());
               resource.setFileName(file.getOriginalFilename());
           }
   ```
   
   If this is a bug, I'd like to submit a PR to fix it.
   
   Have a nice day.
   
   ### Version
   
   3.0.x
   
   ### 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