You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@streampark.apache.org by "ChengJie1053 (via GitHub)" <gi...@apache.org> on 2023/09/23 11:41:40 UTC

[GitHub] [incubator-streampark] ChengJie1053 opened a new pull request, #3171: [Improve] Streampark-common module tika dependency moved to the streampark-console module

ChengJie1053 opened a new pull request, #3171:
URL: https://github.com/apache/incubator-streampark/pull/3171

   Streampark-common module tika dependency moved to the streampark-console module, add MimeTypeUtils


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


[GitHub] [incubator-streampark] wolfboys commented on a diff in pull request #3171: [Improve] Streampark-common module tika dependency moved to the streampark-console module

Posted by "wolfboys (via GitHub)" <gi...@apache.org>.
wolfboys commented on code in PR #3171:
URL: https://github.com/apache/incubator-streampark/pull/3171#discussion_r1335085701


##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/interceptor/UploadFileTypeInterceptor.java:
##########
@@ -46,16 +59,35 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons
             multipartFile, "File to upload can't be null. Upload file failed.");
         boolean isJarOrPyFile =
             FileUtils.isJarFileType(multipartFile.getInputStream())
-                || FileUtils.isPythonFileType(
-                    multipartFile.getContentType(), multipartFile.getInputStream());
+                || isPythonFileType(multipartFile.getContentType(), multipartFile.getInputStream());
         ApiAlertException.throwIfFalse(
             isJarOrPyFile,
-            "Illegal file type, Only support standard jar or py files. Upload file failed.");
+            "Illegal file type, Only support standard jar files. Upload file failed.");
       }
     }
     return true;
   }
 
+  public boolean isPythonFileType(String contentType, InputStream input) {
+    if (StringUtils.isBlank(contentType) || input == null) {
+      throw new RuntimeException("The contentType or inputStream can not be null");
+    }
+    try {
+      return getMimeType(input) == MediaType.TEXT_PLAIN.toString()

Review Comment:
   getMimeType(input).equals(MediaType.TEXT_PLAIN.toString())
   ...



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


[GitHub] [incubator-streampark] wolfboys merged pull request #3171: [Improve] Streampark-common module tika dependency moved to the streampark-console module

Posted by "wolfboys (via GitHub)" <gi...@apache.org>.
wolfboys merged PR #3171:
URL: https://github.com/apache/incubator-streampark/pull/3171


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