From e29fdbfb88122727a891dadec149fd935a005e32 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Tue, 20 Aug 2024 19:39:45 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=94=A8=E4=BE=8B=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=87=BA=E5=A4=A7=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E6=8D=A2=E8=A1=8C=E4=B8=8D=E5=85=A8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1045485 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001045485 --- .../service/FunctionalCaseFileService.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseFileService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseFileService.java index 0a2a38a688..5e9c4fac68 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseFileService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseFileService.java @@ -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("]*>(.*?)

"); Matcher matcher = pattern.matcher(html); - if (matcher.find()) { - String content = matcher.group(1); - return content; + StringBuilder result = new StringBuilder(); + List list = matcher.results().toList(); + if (CollectionUtils.isNotEmpty(list)) { + for (MatchResult matchResult : list) { + result.append(matchResult.group(1)); + } + } else { + result.append(html); } - return html; + + return result.toString(); }