fix:调整 playbook 文件格式
This commit is contained in:
@@ -13,7 +13,9 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileFilter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -261,8 +263,14 @@ public class APIController {
|
|||||||
if (T.FileUtil.extName(file.getOriginalFilename()).equals("zip")) {
|
if (T.FileUtil.extName(file.getOriginalFilename()).equals("zip")) {
|
||||||
File playbookFile = T.FileUtil.file(Constant.TEMP_PATH, tid, file.getOriginalFilename());
|
File playbookFile = T.FileUtil.file(Constant.TEMP_PATH, tid, file.getOriginalFilename());
|
||||||
T.FileUtil.writeBytes(file.getInputStream().readAllBytes(), playbookFile);
|
T.FileUtil.writeBytes(file.getInputStream().readAllBytes(), playbookFile);
|
||||||
playbookAirDir = T.FileUtil.file(Constant.TEMP_PATH, tid, "main.air");
|
File playbookDir = T.FileUtil.file(Constant.TEMP_PATH, tid);
|
||||||
T.ZipUtil.unzip(playbookFile, playbookAirDir);
|
T.ZipUtil.unzip(playbookFile, playbookDir);
|
||||||
|
playbookAirDir = Arrays.stream(playbookDir.listFiles(new FileFilter() {
|
||||||
|
@Override
|
||||||
|
public boolean accept(File pathname) {
|
||||||
|
return pathname.getName().endsWith(".air");
|
||||||
|
}
|
||||||
|
})).findFirst().get();
|
||||||
} else {
|
} else {
|
||||||
appFile = T.FileUtil.file(Constant.TEMP_PATH, tid, file.getOriginalFilename());
|
appFile = T.FileUtil.file(Constant.TEMP_PATH, tid, file.getOriginalFilename());
|
||||||
T.FileUtil.writeBytes(file.getInputStream().readAllBytes(), appFile);
|
T.FileUtil.writeBytes(file.getInputStream().readAllBytes(), appFile);
|
||||||
|
|||||||
Reference in New Issue
Block a user