aboutsummaryrefslogtreecommitdiff
path: root/internal/crud/cli_edit.go
diff options
context:
space:
mode:
authorishaan <contact@ishaan.cc>2026-07-19 18:33:40 +0530
committerishaan <contact@ishaan.cc>2026-07-19 18:33:40 +0530
commite48a02646f60b6fdff8db5c4105896756584ac63 (patch)
tree3371785e68bfe6b14065589ba7fd417d75742595 /internal/crud/cli_edit.go
parentd6449a232e6bd9eb46132c7403a05ac1a756b619 (diff)
reorganize
Diffstat (limited to 'internal/crud/cli_edit.go')
-rw-r--r--internal/crud/cli_edit.go24
1 files changed, 1 insertions, 23 deletions
diff --git a/internal/crud/cli_edit.go b/internal/crud/cli_edit.go
index 50bb8d2..0683439 100644
--- a/internal/crud/cli_edit.go
+++ b/internal/crud/cli_edit.go
@@ -3,7 +3,6 @@ package crud
import (
"fmt"
"os"
- "strconv"
"gitlab.com/whiteboardguy/eno/internal/crypt"
"gitlab.com/whiteboardguy/eno/internal/editor"
@@ -90,28 +89,7 @@ func EditNoteSSH(notePath, privKeyPath, editorString string) error {
return err
}
- idx := -1
- for i, b := range ciphertext {
- if b == ':' {
- idx = i
- break
- }
- }
- if idx == -1 {
- return fmt.Errorf("invalid file format: no header length prefix found")
- }
-
- headerLen, err := strconv.Atoi(string(ciphertext[:idx]))
- if err != nil {
- return fmt.Errorf("failed to parse header length: %v", err)
- }
-
- if headerLen < 0 || idx+1+headerLen > len(ciphertext) {
- return fmt.Errorf("invalid header length %d", headerLen)
- }
-
- headerBytes := ciphertext[idx+1 : idx+1+headerLen]
- headers, err := crypt.GetFileHeaders(headerBytes)
+ headers, _, err := crypt.ParseFileHeaders(ciphertext)
if err != nil {
return fmt.Errorf("failed to read file headers: %v", err)
}