fix: 提交到禅道的缺陷图片显示问题
This commit is contained in:
parent
90bd374998
commit
0cf3b55d3a
|
@ -141,4 +141,17 @@ public abstract class ZentaoClient extends BaseClient {
|
||||||
PASSWD = config.getPassword();
|
PASSWD = config.getPassword();
|
||||||
ENDPOINT = config.getUrl();
|
ENDPOINT = config.getUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getReplaceImgUrl(String replaceImgUrl) {
|
||||||
|
String baseUrl = getBaseUrl();
|
||||||
|
String[] split = baseUrl.split("/");
|
||||||
|
String suffix = split[split.length - 1];
|
||||||
|
if (!StringUtils.equalsAny(suffix, "zentao", "zentaopms", "zentaopro", "zentaobiz")) {
|
||||||
|
suffix = "";
|
||||||
|
} else {
|
||||||
|
suffix = "/" + suffix;
|
||||||
|
}
|
||||||
|
return String.format(replaceImgUrl, suffix);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class ZentaoGetClient extends ZentaoClient {
|
||||||
private static final String USER_GET="&module=user&methodName=getList&t=json&zentaosid=";
|
private static final String USER_GET="&module=user&methodName=getList&t=json&zentaosid=";
|
||||||
private static final String BUILDS_GET="&module=build&methodName=getProductBuildPairs&productID={0}&zentaosid=";
|
private static final String BUILDS_GET="&module=build&methodName=getProductBuildPairs&productID={0}&zentaosid=";
|
||||||
private static final String FILE_UPLOAD="&module=file&methodName=saveUpload&t=json&zentaosid=";
|
private static final String FILE_UPLOAD="&module=file&methodName=saveUpload&t=json&zentaosid=";
|
||||||
private static final String REPLACE_IMG_URL="<img src=\"/zentao/index.php?m=file&f=read&fileID=$1\"/>";
|
private static final String REPLACE_IMG_URL="<img src=\"%s/index.php?m=file&f=read&fileID=$1\"/>";
|
||||||
private static final Pattern IMG_PATTERN = Pattern.compile("m=file&f=read&fileID=(.*?)\"/>");
|
private static final Pattern IMG_PATTERN = Pattern.compile("m=file&f=read&fileID=(.*?)\"/>");
|
||||||
|
|
||||||
RequestUrl request = new RequestUrl();
|
RequestUrl request = new RequestUrl();
|
||||||
|
@ -34,7 +34,7 @@ public class ZentaoGetClient extends ZentaoClient {
|
||||||
request.setUserGet(getUrl(USER_GET));
|
request.setUserGet(getUrl(USER_GET));
|
||||||
request.setBuildsGet(getUrl(BUILDS_GET));
|
request.setBuildsGet(getUrl(BUILDS_GET));
|
||||||
request.setFileUpload(getUrl(FILE_UPLOAD));
|
request.setFileUpload(getUrl(FILE_UPLOAD));
|
||||||
request.setReplaceImgUrl(REPLACE_IMG_URL);
|
request.setReplaceImgUrl(getReplaceImgUrl(REPLACE_IMG_URL));
|
||||||
request.setImgPattern(IMG_PATTERN);
|
request.setImgPattern(IMG_PATTERN);
|
||||||
request.setBugUpdate(getUrl(BUG_UPDATE));
|
request.setBugUpdate(getUrl(BUG_UPDATE));
|
||||||
request.setBugDelete(getNotSuperModelUrl(BUG_DELETE));
|
request.setBugDelete(getNotSuperModelUrl(BUG_DELETE));
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class ZentaoPathInfoClient extends ZentaoClient {
|
||||||
private static final String USER_GET = "/api-getModel-user-getList?zentaosid=";
|
private static final String USER_GET = "/api-getModel-user-getList?zentaosid=";
|
||||||
private static final String BUILDS_GET = "/api-getModel-build-getProductBuildPairs-productID={projectId}?zentaosid=";
|
private static final String BUILDS_GET = "/api-getModel-build-getProductBuildPairs-productID={projectId}?zentaosid=";
|
||||||
private static final String FILE_UPLOAD = "/api-getModel-file-saveUpload.json?zentaosid=";
|
private static final String FILE_UPLOAD = "/api-getModel-file-saveUpload.json?zentaosid=";
|
||||||
private static final String REPLACE_IMG_URL = "<img src=\"/zentao/file-read-$1\"/>";
|
private static final String REPLACE_IMG_URL = "<img src=\"%s/file-read-$1\"/>";
|
||||||
private static final Pattern IMG_PATTERN = Pattern.compile("file-read-(.*?)\"/>");
|
private static final Pattern IMG_PATTERN = Pattern.compile("file-read-(.*?)\"/>");
|
||||||
|
|
||||||
public ZentaoPathInfoClient(String url) {
|
public ZentaoPathInfoClient(String url) {
|
||||||
|
@ -35,7 +35,7 @@ public class ZentaoPathInfoClient extends ZentaoClient {
|
||||||
request.setUserGet(getUrl(USER_GET));
|
request.setUserGet(getUrl(USER_GET));
|
||||||
request.setBuildsGet(getUrl(BUILDS_GET));
|
request.setBuildsGet(getUrl(BUILDS_GET));
|
||||||
request.setFileUpload(getUrl(FILE_UPLOAD));
|
request.setFileUpload(getUrl(FILE_UPLOAD));
|
||||||
request.setReplaceImgUrl(REPLACE_IMG_URL);
|
request.setReplaceImgUrl(getReplaceImgUrl(REPLACE_IMG_URL));
|
||||||
request.setImgPattern(IMG_PATTERN);
|
request.setImgPattern(IMG_PATTERN);
|
||||||
request.setBugUpdate(getUrl(BUG_UPDATE));
|
request.setBugUpdate(getUrl(BUG_UPDATE));
|
||||||
request.setBugDelete(getUrl(BUG_DELETE));
|
request.setBugDelete(getUrl(BUG_DELETE));
|
||||||
|
|
Loading…
Reference in New Issue