浏览代码

更新 ConsoleServiceImpl#registerAndBind 方法中根据 contentType 指定 ObjectType 中的 fileType

reghao 2 天之前
父节点
当前提交
0ee83bb65f
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      oss-mgr/src/main/java/cn/reghao/oss/mgr/rpc/ConsoleServiceImpl.java

+ 4 - 4
oss-mgr/src/main/java/cn/reghao/oss/mgr/rpc/ConsoleServiceImpl.java

@@ -76,8 +76,10 @@ public class ConsoleServiceImpl implements ConsoleService {
     @Override
     public void registerAndBind(UploadResult uploadResult) {
         String contentType = uploadResult.getContentType();
-        int fileType = ObjectType.Any.getValue();
-        if (contentType.startsWith("video")) {
+        int fileType = ObjectType.Other.getValue();
+        if (contentType.startsWith("image")) {
+            fileType = ObjectType.Image.getValue();
+        } else if (contentType.startsWith("video")) {
             fileType = ObjectType.Video.getValue();
         } else if (contentType.startsWith("audio")) {
             fileType = ObjectType.Audio.getValue();
@@ -91,8 +93,6 @@ public class ConsoleServiceImpl implements ConsoleService {
             fileType = ObjectType.DocExcel.getValue();
         } else if (contentType.equals("application/vnd.openxmlformats-officedocument.presentationml.presentation")) {
             fileType = ObjectType.DocPpt.getValue();
-        }  else if (contentType.startsWith("application/")) {
-            fileType = ObjectType.Other.getValue();
         }
 
         long uploadBy = uploadResult.getUploadBy();