refactor(测试跟踪): 同步禅道图片后保存缺陷失败
--bug=1013707 --user=陈建星 【测试跟踪】github #14185禅道创建的bug 包含图片 同步到ms ,在ms编辑缺陷内容,点击保存保存失败 https://www.tapd.cn/55049933/s/1170263
This commit is contained in:
parent
8f12897e9d
commit
4f1053728e
|
@ -35,6 +35,7 @@ import org.springframework.util.LinkedMultiValueMap;
|
|||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.net.URLDecoder;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
|
@ -398,20 +399,30 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
|
|||
while (matcher.find()) {
|
||||
// get file name
|
||||
String originSubUrl = matcher.group(1);
|
||||
String fileName = originSubUrl.substring(10);
|
||||
fileName = resourceService.decodeFileName(fileName);
|
||||
// get file
|
||||
ResponseEntity<FileSystemResource> mdImage = resourceService.getMdImage(fileName);
|
||||
// upload zentao
|
||||
String id = uploadFile(mdImage.getBody());
|
||||
// todo delete local file
|
||||
int index = fileName.lastIndexOf(".");
|
||||
String suffix = "";
|
||||
if (index != -1) {
|
||||
suffix = fileName.substring(index);
|
||||
if (originSubUrl.contains("/url?url=")) {
|
||||
String path = URLDecoder.decode(originSubUrl, StandardCharsets.UTF_8);
|
||||
String fileName;
|
||||
if (path.indexOf("fileID") > 0) {
|
||||
fileName = path.substring(path.indexOf("fileID") + 7);
|
||||
} else {
|
||||
fileName = path.substring(path.indexOf("file-read-") + 10);
|
||||
}
|
||||
zentaoSteps = zentaoSteps.replaceAll(Pattern.quote(originSubUrl), fileName);
|
||||
} else {
|
||||
String fileName = originSubUrl.substring(10);
|
||||
// get file
|
||||
ResponseEntity<FileSystemResource> mdImage = resourceService.getMdImage(fileName);
|
||||
// upload zentao
|
||||
String id = uploadFile(mdImage.getBody());
|
||||
// todo delete local file
|
||||
int index = fileName.lastIndexOf(".");
|
||||
String suffix = "";
|
||||
if (index != -1) {
|
||||
suffix = fileName.substring(index);
|
||||
}
|
||||
// replace id
|
||||
zentaoSteps = zentaoSteps.replaceAll(Pattern.quote(originSubUrl), id + suffix);
|
||||
}
|
||||
// replace id
|
||||
zentaoSteps = zentaoSteps.replaceAll(Pattern.quote(originSubUrl), id + suffix);
|
||||
}
|
||||
// image link
|
||||
String netImgRegex = "!\\[(.*?)]\\((http.*?)\\)";
|
||||
|
|
Loading…
Reference in New Issue