fix(用例管理): 修复导出大字段换行不全的问题

--bug=1045485 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001045485
This commit is contained in:
guoyuqi 2024-08-20 19:39:45 +08:00 committed by Craftsman
parent fb7c51c636
commit e29fdbfb88
1 changed files with 11 additions and 4 deletions

View File

@ -77,6 +77,7 @@ import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.MatchResult;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@ -859,11 +860,17 @@ public class FunctionalCaseFileService {
public String parseHtml(String html) {
Pattern pattern = Pattern.compile("<p[^>]*>(.*?)</p>");
Matcher matcher = pattern.matcher(html);
if (matcher.find()) {
String content = matcher.group(1);
return content;
StringBuilder result = new StringBuilder();
List<MatchResult> list = matcher.results().toList();
if (CollectionUtils.isNotEmpty(list)) {
for (MatchResult matchResult : list) {
result.append(matchResult.group(1));
}
return html;
} else {
result.append(html);
}
return result.toString();
}