Skip to content

Commit 6fcfa28

Browse files
committed
Escape % to avoid "invalid capture index problem" when % in the input
1 parent df53728 commit 6fcfa28

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

lua/chatgpt/flows/actions/chat/init.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ function ChatAction:render_template()
4949
data = vim.tbl_extend("force", {}, data, self.variables)
5050
local result = self.template
5151
for key, value in pairs(data) do
52+
value = value:gsub("%%", "%%%%")
5253
result = result:gsub("{{" .. key .. "}}", value)
5354
end
5455
return result

0 commit comments

Comments
 (0)