文件名重复问题修复

limingyu-20240401-app登录曹实业判断修改
liujun 2024-02-27 11:03:57 +08:00
parent 67f30d793d
commit bbde8cdb2a
1 changed files with 2 additions and 0 deletions

View File

@ -380,6 +380,8 @@ public class Warden {
String fileName = file.getName(); String fileName = file.getName();
if (fileNames.contains(fileName)){ if (fileNames.contains(fileName)){
fileName = (random.nextInt(90000) + 10000) + fileName; fileName = (random.nextInt(90000) + 10000) + fileName;
} else {
fileNames = fileNames + fileName + ",";
} }
ZipEntry zipEntry = new ZipEntry(fileName); ZipEntry zipEntry = new ZipEntry(fileName);
zipOut.putNextEntry(zipEntry); zipOut.putNextEntry(zipEntry);