MCPcopy Index your code
hub / github.com/ZenNotes/zennotes / folderSubpathOf

Method folderSubpathOf

apps/server/internal/vault/vault.go:1571–1585  ·  view source on GitHub ↗

folderSubpathOf returns the note's directory relative to its top-level folder root ("" when it sits at the folder root). Carried along on archive/trash moves so the reverse move restores the subfolder. Mirrors folderSubpathOf in apps/desktop/src/main/vault.ts.

(abs string)

Source from the content-addressed store, hash-verified

1569// archive/trash moves so the reverse move restores the subfolder.
1570// Mirrors folderSubpathOf in apps/desktop/src/main/vault.ts.
1571func (v *Vault) folderSubpathOf(abs string) string {
1572 folder, ok := v.folderOf(abs)
1573 if !ok {
1574 return ""
1575 }
1576 sourceRoot, err := v.folderRoot(folder)
1577 if err != nil {
1578 return ""
1579 }
1580 relDir, err := filepath.Rel(sourceRoot, filepath.Dir(abs))
1581 if err != nil || relDir == "." || strings.HasPrefix(relDir, "..") || filepath.IsAbs(relDir) {
1582 return ""
1583 }
1584 return relDir
1585}
1586
1587func (v *Vault) moveBetweenFolders(rel string, target NoteFolder) (NoteMeta, error) {
1588 v.mu.Lock()

Callers 1

moveBetweenFoldersMethod · 0.95

Calls 2

folderOfMethod · 0.95
folderRootMethod · 0.95

Tested by

no test coverage detected