Forráskód Böngészése

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

reghao 2 napja
szülő
commit
0ee83bb65f

+ 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();