fix(api): normaliza categories/tags nil para [] no JSON

Slices Go nil viram 'null' no JSON, o que quebra clientes com tipos
não-nuláveis com default (kotlinx.serialization rejeita null explícito).
newNoteView/normalizeNote garante [] em list/get/create/update/restore.
Motivado por teste real do cliente Android (duplicava creates ao falhar
o decode da resposta 201).
This commit is contained in:
lgcosta committed 2026-11-04 19:28:06 -03:00
1 parent 11fc26390d
commit 63fd024f68
2 files changed
+23 -4

No files matched your search

+1 -1
View File
@@ -103,7 +103,7 @@ func (s *Server) handleRestore(w http.ResponseWriter, r *http.Request) {
return
}
s.publishSaved(n, in.Author, in.Session, false)
writeJSON(w, http.StatusOK, noteView{n, content})
writeJSON(w, http.StatusOK, newNoteView(n, content))
}
func short(hash string) string {