fix: public_note validation rejects non-object JSON values, preventing second edit (#154)

Co-authored-by: naiba <naiba@users.noreply.github.com>
This commit is contained in:
奶爸
2026-02-19 14:30:10 +08:00
committed by GitHub
parent 2fe19adb96
commit d04c4a1784
+1
View File
@@ -72,6 +72,7 @@ const serverFormSchema = z.object({
if (s.length === 0) return true if (s.length === 0) return true
try { try {
const obj = JSON.parse(s) const obj = JSON.parse(s)
if (typeof obj !== "object" || obj === null) return true
return PublicNoteSchema.safeParse(obj).success return PublicNoteSchema.safeParse(obj).success
} catch { } catch {
// skip check if not JSON // skip check if not JSON