Skip to content

Commit 771c72d

Browse files
committed
Fix invalid pathname in z -I xyz on Windows.
The fzf interactive mode (`-I`) constructs a `tmpname` pathname and tries to sanitize it by stripping all `\` characters. But it missed stripping all `:` characters, and the command printed this error output: The filename, directory name, or volume label syntax is incorrect. The `tmpname` looked like "c:\tmp\Temp\zlua_c:tmpTempsh2k0.txt", and the embedded `:` caused the error output. This commit adds `:` to the list of characters to be stripped (only on Windows).
1 parent 4bbd0f1 commit 771c72d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

z.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,7 +1676,7 @@ function z_cd(patterns)
16761676
end
16771677
cmd = cmd .. ' < "' .. tmpname .. '"'
16781678
else
1679-
tmpname = os.tmpname():gsub('\\', ''):gsub('%.', '')
1679+
tmpname = os.tmpname():gsub('[\\:]', ''):gsub('%.', '')
16801680
tmpname = os.environ('TMP', '') .. '\\zlua_' .. tmpname .. '.txt'
16811681
cmd = 'type "' .. tmpname .. '" | ' .. cmd
16821682
end
@@ -1873,7 +1873,7 @@ function cd_breadcrumbs(pwd, interactive)
18731873
if not windows then
18741874
tmpname = os.tmpname()
18751875
else
1876-
tmpname = os.tmpname():gsub('\\', ''):gsub('%.', '')
1876+
tmpname = os.tmpname():gsub('[\\:]', ''):gsub('%.', '')
18771877
tmpname = os.environ('TMP', '') .. '\\zlua_' .. tmpname .. '.txt'
18781878
end
18791879
fp = io.open(tmpname, 'w')

0 commit comments

Comments
 (0)