게시판 수정
This commit is contained in:
parent
11550daf6f
commit
b3e3cc7277
@ -267,38 +267,6 @@ public class localbordService {
|
||||
}
|
||||
}
|
||||
|
||||
private String procPlainTextFromJson(String jsonContent) {
|
||||
StringBuilder plainTextBuilder = new StringBuilder();
|
||||
try {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
JsonNode rootNode = objectMapper.readTree(jsonContent);
|
||||
|
||||
// JSON 배열인지 확인
|
||||
if (!rootNode.isArray()) {
|
||||
System.err.println("JSON content is not an array");
|
||||
return "";
|
||||
}
|
||||
|
||||
// JSON 노드 순회
|
||||
for (JsonNode node : rootNode) {
|
||||
JsonNode insertNode = node.get("insert");
|
||||
|
||||
// insert 노드가 텍스트인지 확인
|
||||
if (insertNode != null && insertNode.isTextual()) {
|
||||
String text = insertNode.asText();
|
||||
|
||||
// '\n' 제거하고 순수 텍스트만 추가
|
||||
if (!text.trim().isEmpty() && !text.trim().equals("\n")) {
|
||||
plainTextBuilder.append(text.trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException("Failed to extract plain text: " + e.getMessage(), e);
|
||||
}
|
||||
return plainTextBuilder.toString();
|
||||
}
|
||||
|
||||
private void enrichBoardDetail(MapDto boardDetail) {
|
||||
if(boardDetail == null) return;
|
||||
@ -336,8 +304,6 @@ public class localbordService {
|
||||
String firstImageUrl = procFirstImageUrl(contentString);
|
||||
post.put("firstImageUrl", firstImageUrl);
|
||||
|
||||
String plainContent = procPlainTextFromJson(contentString);
|
||||
post.put("plainContent", plainContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user