fix(api): restrict fallback note to string-typed JSON values

Only emit note in listAuthFilesFromDisk when the JSON value is actually
a string (gjson.String), matching the synthesizer/buildAuthFileEntry
behavior. Non-string values like numbers or booleans are now ignored
instead of being coerced via gjson.String().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
RGBadmin
2026-03-15 23:00:17 +08:00
parent 8d8f5970ee
commit c1241a98e2

View File

@@ -342,7 +342,7 @@ func (h *Handler) listAuthFilesFromDisk(c *gin.Context) {
}
}
}
if nv := gjson.GetBytes(data, "note"); nv.Exists() {
if nv := gjson.GetBytes(data, "note"); nv.Exists() && nv.Type == gjson.String {
if trimmed := strings.TrimSpace(nv.String()); trimmed != "" {
fileData["note"] = trimmed
}