fix: note/file move ops, rename/move atomicity, importDir folder creation
- importDir: create physical folder for imported directories - RenameNode/MoveNode: os.Rename before DB updates (atomicity) - RenameNode note/file: fail if physical file missing - MoveNode: file renames before DB updates - applyRemoteNoteOp: handle OpMove for notes/files - applyRemoteNodeMove: handle notes/files with empty FsPath - MoveNode sync payload: no fs_path for notes/files - Add 7 tests covering all fixes
This commit is contained in:
@@ -526,6 +526,11 @@ func (s *Service) importDir(parentID, sourcePath, dirName string, copyMode bool)
|
||||
}
|
||||
_ = s.nodes.UpdateFsPath(folderNode.ID, folderFsPath)
|
||||
|
||||
physPath := filepath.Join(s.vaultRoot, folderFsPath)
|
||||
if err := os.MkdirAll(physPath, 0o750); err != nil {
|
||||
return nil, fmt.Errorf("create folder for imported dir: %w", err)
|
||||
}
|
||||
|
||||
entries, err := os.ReadDir(sourcePath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user