fix: writeValueAsString异常处理

This commit is contained in:
mediabot-pt
2026-07-06 00:40:35 +08:00
parent 5345b506e2
commit 92e0098680

View File

@@ -118,10 +118,11 @@ public class SitePagesController {
@SuppressWarnings("unchecked")
var entries = (List<Map<String, Object>>) payload.get("entries");
sitePagesService.savePages("default:" + type, entries != null ? entries : List.of());
String json = payload.containsKey("entries")
? new com.fasterxml.jackson.databind.ObjectMapper().writeValueAsString(entries)
: "[]";
storageService.store("pages/default/" + type + ".json", json);
try {
String json = entries != null
? new com.fasterxml.jackson.databind.ObjectMapper().writeValueAsString(entries) : "[]";
storageService.store("pages/default/" + type + ".json", json);
} catch (Exception ignored) {}
return ApiResponse.success();
}