fix: 禅道GET方式同步图片失败

--bug=1013432 --user=陈建星 [缺陷管理] github#13685通过metersphere平台创建缺陷,同步至禅道缺陷之后,meterphere点击【同步缺陷】,禅道缺陷同步失败 https://www.tapd.cn/55049933/s/1163920
This commit is contained in:
chenjianxing 2022-05-25 16:17:19 +08:00 committed by jianxing
parent 06563b66a0
commit b263fb8f81
1 changed files with 5 additions and 2 deletions

View File

@ -15,6 +15,7 @@ import io.metersphere.commons.utils.LogUtil;
import io.metersphere.dto.UserDTO; import io.metersphere.dto.UserDTO;
import io.metersphere.track.dto.DemandDTO; import io.metersphere.track.dto.DemandDTO;
import io.metersphere.track.issue.client.ZentaoClient; import io.metersphere.track.issue.client.ZentaoClient;
import io.metersphere.track.issue.client.ZentaoGetClient;
import io.metersphere.track.issue.domain.PlatformUser; import io.metersphere.track.issue.domain.PlatformUser;
import io.metersphere.track.issue.domain.zentao.AddIssueResponse; import io.metersphere.track.issue.domain.zentao.AddIssueResponse;
import io.metersphere.track.issue.domain.zentao.GetIssueResponse; import io.metersphere.track.issue.domain.zentao.GetIssueResponse;
@ -446,8 +447,7 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
} }
if (Arrays.stream(imgArray).anyMatch(imgType -> StringUtils.equals(imgType, srcContent.substring(srcContent.indexOf('.') + 1)))) { if (Arrays.stream(imgArray).anyMatch(imgType -> StringUtils.equals(imgType, srcContent.substring(srcContent.indexOf('.') + 1)))) {
if (zentaoClient.getBaseUrl().contains("biz")) { if (zentaoClient instanceof ZentaoGetClient) {
// 禅道企业版
path = zentaoClient.getBaseUrl() + "/index.php?m=file&f=read&fileID=" + srcContent; path = zentaoClient.getBaseUrl() + "/index.php?m=file&f=read&fileID=" + srcContent;
} else { } else {
// 禅道开源版 // 禅道开源版
@ -456,6 +456,9 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
} else { } else {
return result; return result;
} }
} else {
name = name.replaceAll("&", "&");
path = zentaoClient.getBaseUrl() + path.replaceAll("&", "&");
} }
// 图片与描述信息之间需换行否则无法预览图片 // 图片与描述信息之间需换行否则无法预览图片
result = "\n\n![" + name + "](" + path + ")"; result = "\n\n![" + name + "](" + path + ")";