fix 节点分发文件中心、静态文件后文件自动被删除

This commit is contained in:
bwcx_jzy 2024-01-17 16:32:39 +08:00
parent 0cf80417f9
commit bd418e50af
No known key found for this signature in database
GPG Key ID: E187D6E9DDDE8C53
2 changed files with 8 additions and 4 deletions

View File

@ -10,6 +10,7 @@
1. 【all】优化 机器状态新增:资源监控异常(资源监控异常不影响功能使用)
2. 【server】优化 取消登录页动态背景图
3. 【server】修复 节点分发文件中心、静态文件后文件自动被删除(感谢@九問)
------

View File

@ -314,7 +314,7 @@ public class OutGivingProjectController extends BaseServerController {
File file = FileUtil.file(serverConfig.getUserTempPath(), ServerConst.OUTGIVING_FILE, id);
FileUtil.mkdir(file);
File downloadFile = HttpUtil.downloadFileFromUrl(url, file);
this.startTask(outGivingModel, downloadFile, autoUnzip, stripComponents, selectProject);
this.startTask(outGivingModel, downloadFile, autoUnzip, stripComponents, selectProject, true);
return JsonMessage.success("下载成功,开始分发!");
}
@ -404,7 +404,7 @@ public class OutGivingProjectController extends BaseServerController {
outGivingServer.updateById(outGivingModel);
File storageSavePath = serverConfig.fileStorageSavePath();
File file = FileUtil.file(storageSavePath, storageModel.getPath());
this.startTask(outGivingModel, file, autoUnzip, stripComponents, selectProject);
this.startTask(outGivingModel, file, autoUnzip, stripComponents, selectProject, false);
return JsonMessage.success("开始分发!");
}
@ -438,7 +438,7 @@ public class OutGivingProjectController extends BaseServerController {
outGivingServer.updateById(outGivingModel);
File file = FileUtil.file(storageModel.getAbsolutePath());
this.startTask(outGivingModel, file, autoUnzip, stripComponents, selectProject);
this.startTask(outGivingModel, file, autoUnzip, stripComponents, selectProject, false);
return JsonMessage.success("开始分发!");
}
@ -453,7 +453,8 @@ public class OutGivingProjectController extends BaseServerController {
*/
private void startTask(OutGivingModel outGivingModel, File file, String autoUnzip,
String stripComponents,
String selectProject) {
String selectProject,
boolean deleteFile) {
Assert.state(FileUtil.isFile(file), "当前文件丢失不能执行发布任务");
//
boolean unzip = BooleanUtil.toBoolean(autoUnzip);
@ -468,6 +469,8 @@ public class OutGivingProjectController extends BaseServerController {
.unzip(unzip)
.mode(outGivingModel.getMode())
.modeData(outGivingModel.getModeData())
// 是否删除
.doneDeleteFile(deleteFile)
// 可以不再设置-会查询最新的
// .projectSecondaryDirectory(secondaryDirectory)
.stripComponents(stripComponentsValue);