Просмотр исходного кода

一键下载标题带斜杠问题处理

o2sword 5 лет назад
Родитель
Сommit
2d494c7b0d

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

@@ -1228,7 +1228,7 @@ public class Business {
 		}
 		try (ZipOutputStream zos = new ZipOutputStream(os)) {
 			for (Map.Entry<String, Attachment> entry : filePathMap.entrySet()) {
-				zos.putNextEntry(new ZipEntry(entry.getKey()));
+				zos.putNextEntry(new ZipEntry(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()) {
@@ -1241,7 +1241,7 @@ public class Business {
 
 			if (otherAttMap != null) {
 				for (Map.Entry<String, byte[]> entry : otherAttMap.entrySet()) {
-					zos.putNextEntry(new ZipEntry(entry.getKey()));
+					zos.putNextEntry(new ZipEntry(StringUtils.replaceEach(entry.getKey(), new String[]{"/","\\"}, new String[]{"-","-"})));
 					zos.write(entry.getValue());
 				}
 			}