Fix complex strings failing to copy on Windows

This commit is contained in:
2024-03-11 15:09:30 -04:00
parent c7735d32be
commit 5cee48d412
4 changed files with 11 additions and 9 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ import (
// CopyField copies a field from an entry to the clipboard
func copyField(copySubject string, executableName string) {
cmd := exec.Command("powershell.exe", "-c", fmt.Sprintf("echo '%s' | Set-Clipboard", copySubject))
cmd := exec.Command("powershell.exe", "-c", fmt.Sprintf("echo '%s' | Set-Clipboard", strings.ReplaceAll(copySubject, "'", "''")))
err := cmd.Run()
if err != nil {
fmt.Println(AnsiError + "Failed to copy to clipboard: " + err.Error() + AnsiReset)