You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@streampark.apache.org by GitBox <gi...@apache.org> on 2022/10/11 03:36:00 UTC

[GitHub] [incubator-streampark] WillemJiang commented on a diff in pull request #1799: [Improve] Add file name interception

WillemJiang commented on code in PR #1799:
URL: https://github.com/apache/incubator-streampark/pull/1799#discussion_r991784040


##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ApplicationServiceImpl.java:
##########
@@ -293,7 +294,8 @@ public void tailMvnDownloading(Long id) {
     @Override
     public String upload(MultipartFile file) throws ApplicationException {
         File temp = WebUtils.getAppTempDir();
-        File saveFile = new File(temp, Objects.requireNonNull(file.getOriginalFilename()));
+        String fileName = FilenameUtils.getName(Objects.requireNonNull(file.getOriginalFilename()));
+        File saveFile = new File(temp, fileName);
         // delete when exists
         if (saveFile.exists()) {

Review Comment:
   Not sure if it can cause some side effects.



##########
streampark-console/streampark-console-service/src/test/java/org/apache/streampark/console/core/service/ApplicationServiceTest.java:
##########
@@ -89,4 +94,15 @@ public void start() throws Exception {
         applicationService.start(application, false);
     }
 
+    @Test
+    public void uploadTest() throws Exception {

Review Comment:
   I think we need to add another test for verifying the uploaded file is not a jar file.
   It looks like we just verify the ContentType



-- 
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: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org