fix: 调整 playbook 上传时,保存文件的名称

This commit is contained in:
zhangshuai
2024-10-29 13:53:56 +08:00
parent 2e4f823211
commit 634ac2b8bb

View File

@@ -47,11 +47,15 @@ public class PlaybookServiceImpl extends ServiceImpl<PlaybookDao, PlaybookEntity
throw new ASWException(RCode.PLAYBOOK_NAME_DUPLICATE);
}
File destination = T.FileUtil.file(Constants.PLAYBOOK_FILES_DIR, name);
File unzip = null;
PlaybookEntity playbook = new PlaybookEntity();
PlaybookEntity playbook = new PlaybookEntity();
String playbookId = T.StrUtil.uuid();
String fileExtName = T.StrUtil.emptyToDefault(T.FileUtil.extName(file.getName()), "zip");
String saveFileName = playbookId + "." + fileExtName;
File destination = T.FileUtil.file(Constants.PLAYBOOK_FILES_DIR, saveFileName);
File unzip = null;
try {
playbook.setId(playbookId);
playbook.setWorkspaceId(workspaceId);
playbook.setName(name);
playbook.setDescription(description);