Skip to content

Commit 13f9959

Browse files
authored
fix: path normalize with one char directories (#348)
1 parent c54f77d commit 13f9959

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lua/plenary/path.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ local function _normalize_path(filename, cwd)
8989
end
9090

9191
-- handles redundant `./` in the middle
92-
local redundant = path.sep .. "." .. path.sep
92+
local redundant = path.sep .. "%." .. path.sep
9393
if filename:match(redundant) then
9494
filename = filename:gsub(redundant, path.sep)
9595
end

tests/plenary/path_spec.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ describe("Path", function()
168168
end)
169169

170170
describe(":normalize", function()
171+
it("can take path that has one character directories", function()
172+
local orig = "/home/j/./p//path.lua"
173+
local final = Path:new(orig):normalize()
174+
assert.are.same(final, "/home/j/p/path.lua")
175+
end)
176+
171177
it("can take paths with double separators change them to single separators", function()
172178
local orig = "/lua//plenary/path.lua"
173179
local final = Path:new(orig):normalize()

0 commit comments

Comments
 (0)