فهرست منبع

一键下载标题特殊字符处理

o2sword 5 سال پیش
والد
کامیت
2e6d665fcf

+ 1 - 1
o2server/x_general_core_entity/src/main/java/com/x/general/core/entity/file/GeneralFile.java

@@ -163,7 +163,7 @@ public class GeneralFile extends StorageObject {
 	@FieldDescribe("文件名称.")
 	@Column(length = length_255B, name = ColumnNamePrefix + name_FIELDNAME)
 	@Index(name = TABLE + IndexNameMiddle + name_FIELDNAME)
-	@CheckPersist(allowEmpty = false, fileNameString = true)
+	@CheckPersist(allowEmpty = false)
 	private String name;
 
 	public static final String extension_FIELDNAME = "extension";

+ 4 - 4
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/Business.java

@@ -1229,8 +1229,8 @@ public class Business {
 		}
 		try (ZipOutputStream zos = new ZipOutputStream(os)) {
 			for (Map.Entry<String, Attachment> entry : filePathMap.entrySet()) {
-				zos.putNextEntry(new ZipEntry(new ZipEntry(StringUtils.replaceEach(entry.getKey(),
-						new String[] { "/", "\\" }, new String[] { "-", "-" }))));
+				zos.putNextEntry(new ZipEntry(StringUtils.replaceEach(entry.getKey(),
+						new String[] { "/",":","*","?","<<",">>","|","<",">","\\" }, new String[] { "","","","","","","","","","" })));
 				StorageMapping mapping = ThisApplication.context().storageMappings().get(Attachment.class,
 						entry.getValue().getStorage());
 				try (ByteArrayOutputStream os1 = new ByteArrayOutputStream()) {
@@ -1243,8 +1243,8 @@ public class Business {
 
 			if (otherAttMap != null) {
 				for (Map.Entry<String, byte[]> entry : otherAttMap.entrySet()) {
-					zos.putNextEntry(new ZipEntry(StringUtils.replaceEach(entry.getKey(), new String[] { "/", "\\" },
-							new String[] { "-", "-" })));
+					zos.putNextEntry(new ZipEntry(StringUtils.replaceEach(entry.getKey(),
+							new String[] { "/",":","*","?","<<",">>","|","<",">","\\" }, new String[] { "","","","","","","","","","" })));
 					zos.write(entry.getValue());
 				}
 			}

+ 2 - 1
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionBatchDownloadWithWorkOrWorkCompleted.java

@@ -100,7 +100,8 @@ class ActionBatchDownloadWithWorkOrWorkCompleted extends BaseAction {
 					emc.commit();
 				}
 			}
-
+			fileName = StringUtils.replaceEach(fileName,
+					new String[] { "/",":","*","?","<<",">>","|","<",">","\\" }, new String[] { "","","","","","","","","","" });
 			logger.info("batchDown to {},att size {}, from work {}", fileName, attachmentList.size(), workId);
 			try (ByteArrayOutputStream os = new ByteArrayOutputStream()) {
 				business.downToZip(readableAttachmentList, os, map);

+ 2 - 0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionBatchDownloadWithWorkOrWorkCompletedStream.java

@@ -101,6 +101,8 @@ class ActionBatchDownloadWithWorkOrWorkCompletedStream extends BaseAction {
 				}
 			}
 
+			fileName = StringUtils.replaceEach(fileName,
+					new String[] { "/",":","*","?","<<",">>","|","<",">","\\" }, new String[] { "","","","","","","","","","" });
 			logger.info("batchDown to {},att size {}, from work {}, has form {}", fileName, attachmentList.size(),
 					workId, map.size());
 			try (ByteArrayOutputStream os = new ByteArrayOutputStream()) {

+ 1 - 1
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionUploadWorkInfo.java

@@ -42,7 +42,7 @@ import com.x.processplatform.core.entity.content.WorkCompleted;
 
 class ActionUploadWorkInfo extends BaseAction {
 
-	private static Logger logger = LoggerFactory.getLogger(ActionEdit.class);
+	private static Logger logger = LoggerFactory.getLogger(ActionUploadWorkInfo.class);
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, String workId, String flag, JsonElement jsonElement)
 			throws Exception {