Skip to content

Commit

Permalink
fix: installation would fail on rocks with special characters
Browse files Browse the repository at this point in the history
For instance `haskell-tools.nvim` would fail to load as its name would
be interpreted as a lua pattern.
  • Loading branch information
vhyrro committed Oct 26, 2023
1 parent 403d032 commit e5edb77
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lua/rocks/operations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ operations.install = function(name, version)
else
future.set({
name = name,
version = obj.stdout:match(name .. "%s+(%d+%.%d+%.%d+%-%d+)"),
-- The `gsub` makes sure to escape all punctuation characters
-- so they do not get misinterpeted by the lua pattern engine.
version = obj.stdout:match(name:gsub("%p", "%%%1") .. "%s+(%d+%.%d+%.%d+%-%d+)"),
})
end
end)
Expand Down

0 comments on commit e5edb77

Please sign in to comment.