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
+4 -1
View File
@@ -4,9 +4,11 @@ import (
"database/sql"
"errors"
"fmt"
"path/filepath"
"time"
"verstak/internal/core/storage"
"verstak/internal/core/templates"
"verstak/internal/core/util"
)
@@ -264,7 +266,8 @@ func (r *Repository) UpdateFsPathRecursive(id, newFsPath string) error {
return err
}
for _, child := range children {
childPath := newFsPath + "/" + child.Slug
seg := templates.SafeDisplayNameToPathSegment(child.Title)
childPath := filepath.Join(newFsPath, seg)
if err := r.UpdateFsPathRecursive(child.ID, childPath); err != nil {
return err
}