refactor: integra reconcile no boot, dedup categoria/pasta, CI, Go 1.24
ci / check (push) Successful in 4m12s
ci / check (push) Successful in 4m12s
- Boot chama ReconcileBlobs com log de órfãos (era código morto)
- treeNode/validTreeName/siblingDup/moveCreatesCycle compartilhados
entre Create/Update Category/Folder (mesma regra, um só lugar)
- mapStoreErrorFor com mensagens 404 por recurso (nota/arquivo/pasta/categoria)
- revisionHash helper + teste GET /revisions/{hash} (200 + 404)
- ReconcileBlobs com lock curto (coleta sob RLock, I/O fora do lock)
- AddFile com LimitReader no stream (cap antes de gravar, não depois)
- DeleteFile/DeleteFolder transacionais com rollback em memória
- attachmentKind único no frontend (syntax/html/preview)
- CI: gofmt, vet, test -race, node --check; go.mod 1.24 = Dockerfile
- README: notas operacionais (memória, proxy, boot, SSE, 413/400)
This commit is contained in:
1 parent
0e59ef23f4
commit
e0bef77e31
16 files changed
+518
-126
No files matched your search
+3
-10
@@ -4,7 +4,6 @@ import (
|
||||
"errors"
|
||||
"io/fs"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/lgcosta/notas-online/internal/store"
|
||||
)
|
||||
@@ -88,7 +87,6 @@ func (s *Server) handleListNotes(w http.ResponseWriter, r *http.Request) {
|
||||
func (s *Server) handleCreateNote(w http.ResponseWriter, r *http.Request) {
|
||||
var in noteInput
|
||||
if err := decodeJSON(w, r, &in, maxBody); err != nil {
|
||||
writeError(w, http.StatusBadRequest, "corpo JSON inválido")
|
||||
return
|
||||
}
|
||||
title, format, categories, content, author, message, _ := in.fields()
|
||||
@@ -113,7 +111,6 @@ func (s *Server) handleGetNote(w http.ResponseWriter, r *http.Request) {
|
||||
func (s *Server) handleUpdateNote(w http.ResponseWriter, r *http.Request) {
|
||||
var in noteInput
|
||||
if err := decodeJSON(w, r, &in, maxBody); err != nil {
|
||||
writeError(w, http.StatusBadRequest, "corpo JSON inválido")
|
||||
return
|
||||
}
|
||||
title, format, categories, content, author, message, baseHash := in.fields()
|
||||
@@ -172,14 +169,10 @@ func (s *Server) handleRaw(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// sanitizeFilename elimina caracteres que quebrariam o header.
|
||||
// Delega à helper da store (mesma regra de sanitizeHeaderName) para não
|
||||
// duplicar a política de sanitização entre pacotes.
|
||||
func sanitizeFilename(name string) string {
|
||||
return strings.Map(func(r rune) rune {
|
||||
switch r {
|
||||
case '"', '\\', '\n', '\r', '/':
|
||||
return '_'
|
||||
}
|
||||
return r
|
||||
}, name)
|
||||
return store.SanitizeHeaderName(name)
|
||||
}
|
||||
|
||||
func (s *Server) handleTags(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
Reference in new issue
Block a user