Procházet zdrojové kódy

1.资源上传时过滤.json材质描述文件

hellohaidie před 5 měsíci
rodič
revize
01a3c7ab96

+ 3 - 5
src/main/java/com/lqkj/link/module/zone/service/ResourceService.java

@@ -1,19 +1,17 @@
1 1
 package com.lqkj.link.module.zone.service;
2 2
 
3 3
 import com.lqkj.link.module.authority.repository.UserInfoRepository;
4
-import com.lqkj.link.module.config.domain.ConfigInfo;
5
-import com.lqkj.link.module.config.repository.ConfigInfoRepository;
6 4
 import com.lqkj.link.module.zone.domain.ModelCategory;
7 5
 import com.lqkj.link.module.zone.domain.ModelInfo;
8 6
 import com.lqkj.link.module.zone.repository.ModelCategoryRepository;
9 7
 import com.lqkj.link.module.zone.repository.ModelInfoRepository;
10 8
 import com.lqkj.link.util.Unzipper;
11
-import org.springframework.transaction.annotation.Transactional;
12 9
 import org.apache.commons.compress.archivers.ArchiveException;
13 10
 import org.springframework.data.domain.Page;
14 11
 import org.springframework.data.domain.PageRequest;
15 12
 import org.springframework.data.domain.Pageable;
16 13
 import org.springframework.stereotype.Service;
14
+import org.springframework.transaction.annotation.Transactional;
17 15
 
18 16
 import java.io.File;
19 17
 import java.io.IOException;
@@ -74,10 +72,10 @@ public class ResourceService {
74 72
                 File[] models = modelFolder.listFiles();
75 73
                 assert models != null;
76 74
                 for (File model : models) {
77
-                    if (model.isFile()) {
75
+                    if (model.isFile() && model.getName().endsWith(".fbx")) {
78 76
                         String modelFileName = model.getName();
79 77
                         String modelPath = "/upload/resource/" + category.getCategoryId() + "/model/";
80
-                        if (modelFileName.matches(".*[\u4e00-\u9fa5]+.*")) {
78
+                        if (modelFileName.matches(".*[一-龥]+.*")) {
81 79
                             // 如果包含中文,重命名
82 80
                             String newFileName = UUID.randomUUID() + ".fbx";
83 81
                             modelPath += newFileName;