From 3f03eb4af334b5328afac91f9077f86322496650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=98=8C?= <--global> Date: Fri, 3 Jan 2025 15:34:41 +0800 Subject: [PATCH] fix: file type store list --- store/file-store/file.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/store/file-store/file.go b/store/file-store/file.go index e34bac4..b96c216 100644 --- a/store/file-store/file.go +++ b/store/file-store/file.go @@ -111,10 +111,17 @@ func (s *FileStore) SearchName(ctx context.Context, name string) ([]*store.Passw var passwd store.Passwd content, err := os.ReadFile(path) if err != nil { + fmt.Println(err) return nil, err } - if err := json.Unmarshal(content, &passwd); err != nil { + decodedBytes, err := base64.StdEncoding.DecodeString(string(content)) + if err != nil { + fmt.Println("解码失败:", err) + os.Exit(1) + } + + if err := json.Unmarshal(decodedBytes, &passwd); err != nil { return nil, err }