Skip to content

Commit b0f8b58

Browse files
committed
pref: Return empty string for null or empty input
1 parent 3fcf787 commit b0f8b58

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

src/main/java/top/howiehz/halo/plugin/extra/api/service/basic/post/render/pangu/impl/PanguSpacingServiceImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public PanguSpacingServiceImpl() {
3838
@Override
3939
public String applySpacingInHtml(String htmlContent) {
4040
if (htmlContent == null || htmlContent.isEmpty()) {
41-
return htmlContent;
41+
return "";
4242
}
4343

4444
try {
@@ -72,7 +72,7 @@ public String applySpacingInHtml(Map<String, Object> params) {
7272

7373
String htmlContent = htmlContentObj.toString();
7474
if (htmlContent.isEmpty()) {
75-
return htmlContent;
75+
return "";
7676
}
7777

7878
// Extract selector (optional)
@@ -115,7 +115,7 @@ public String applySpacingInHtml(Map<String, Object> params) {
115115
@Override
116116
public String applySpacingInText(String text) {
117117
if (text == null || text.isEmpty()) {
118-
return text;
118+
return "";
119119
}
120120
try {
121121
return pangu.spacingText(text);

src/main/java/top/howiehz/halo/plugin/extra/api/service/js/post/render/shiki/ShikiRenderCodeService.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ public String renderCode(String content, ShikiConfig shikiConfig) {
239239

240240
// 返回最终 HTML 内容,避免 Jsoup 自动格式化破坏原始结构(如多行 mermaid 代码无分号结尾时)
241241
doc.outputSettings(new Document.OutputSettings().prettyPrint(false));
242-
243242
return doc.body().html();
244243
}
245244

0 commit comments

Comments
 (0)