fix: complete vault layout transition — fs_path everywhere, no more spaces/

- notes.Create(): .md files stored in parent node's fs_path folder
- files.CopyIntoVault/CreateEmptyFile/Duplicate: use parent fs_path
- files.AddPathCopy/AddPathLink: use parent fs_path, set folder fs_path
- files.DeleteNodeAndChildren: move physical folder to .verstak/trash
- UpdateFsPathRecursive: use SafeDisplayNameToPathSegment(child.Title)
- sync_apply.go note ops: use fs_path instead of spaces/
- internal/gui/server.go file upload: use n.FsPath instead of nodeSlug
- VaultCheck diagnostic: walk nodes/files, verify paths on disk
- Tests: create/rename/move/delete/name-conflict/vault-check all pass
This commit is contained in:
2026-06-02 15:43:40 +08:00
parent 0b26f7e5b3
commit 4f01f2de2e
11 changed files with 599 additions and 33 deletions
+6 -2
View File
@@ -309,14 +309,18 @@ func (s *Server) handleFileUpload(w http.ResponseWriter, r *http.Request) {
var req struct {
NodeID string `json:"node_id"`
FilePath string `json:"file_path"`
NodeSlug string `json:"node_slug"`
}
json.NewDecoder(r.Body).Decode(&req)
if req.NodeID == "" || req.FilePath == "" {
jsonErr(w, 400, "node_id and file_path required")
return
}
rec, err := s.files.CopyIntoVault(req.NodeID, req.FilePath, req.NodeSlug)
n, err := s.nodes.GetActive(req.NodeID)
if err != nil {
jsonErr(w, 404, "node not found")
return
}
rec, err := s.files.CopyIntoVault(req.NodeID, req.FilePath, n.FsPath)
if err != nil {
jsonErr(w, 500, err.Error())
return