Skip to content

Commit dfc97ce

Browse files
committed
correctly escape backslashes in wsh setbg. fixes windows paths #1604
1 parent 0c9f357 commit dfc97ce

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)