Skip to content

Commit

Permalink
Unescape double backticks in passwords (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
marevers authored Feb 4, 2025
1 parent 6fbe662 commit 040b281
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/get-entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ pleasant-cli get entry --path <path> --attachments`,

pleasant.Exit(en.Username)
case cmd.Flags().Changed("password"):
pleasant.Exit(pleasant.TrimDoubleQuotes(entry))
pleasant.Exit(pleasant.Unescape(pleasant.TrimDoubleQuotes(entry)))
default:
pleasant.Exit(entry)
}
Expand Down
4 changes: 4 additions & 0 deletions pleasant/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,10 @@ func TrimDoubleQuotes(str string) string {
return str
}

func Unescape(str string) string {
return strings.ReplaceAll(str, `\\`, `\`)
}

func Exit(msg ...any) {
fmt.Println(msg...)
os.Exit(0)
Expand Down

0 comments on commit 040b281

Please sign in to comment.