fix: content_type字段截断过长的值,只保留html/json

This commit is contained in:
mediabot-pt
2026-07-02 13:28:38 +08:00
parent 3c7a3d80f8
commit a5f007a088

View File

@@ -46,7 +46,11 @@ public class AccessResultServiceImpl implements AccessResultService {
public AccessResult submit(String siteId, String configVersion, String clientId,
String contentType, String content, String url,
Integer statusCode, Integer responseTimeMs, Long submitterId) {
String type = (contentType != null && !contentType.isBlank()) ? contentType : "html";
// content_type 只保留简短值(html/json),截断过长的
String type = (contentType != null && !contentType.isBlank()) ?
(contentType.length() > 10 ? contentType.substring(0, 10) : contentType) : "html";
type = type.contains("json") ? "json" : type.contains("html") ? "html" :
type.length() > 4 ? "html" : type;
String ext = "json".equalsIgnoreCase(type) ? "json" : "html";
// 去重:5分钟内相同site+url+contentHash跳过