Skip to content

Commit 9521e1d

Browse files
authored
correctly escape backslashes in wsh setbg. fixes windows paths #1604 (#1636)
1 parent 0c9f357 commit 9521e1d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cmd/wsh/cmd/wshcmd-setbg.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ func setBgRun(cmd *cobra.Command, args []string) (rtnErr error) {
140140
}
141141

142142
// Create URL-safe path
143-
escapedPath := strings.ReplaceAll(absPath, "'", "\\'")
143+
escapedPath := strings.ReplaceAll(absPath, "\\", "\\\\")
144+
escapedPath = strings.ReplaceAll(escapedPath, "'", "\\'")
144145
bgStyle = fmt.Sprintf("url('%s')", escapedPath)
145146

146147
switch {

0 commit comments

Comments
 (0)