Skip to content

Commit

Permalink
fix: remove escape_char since we are now using """ quoted strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Alvaro Muñoz committed Sep 25, 2024
1 parent 955f0fd commit a0adb2a
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions lua/octo/gh/graphql.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3229,14 +3229,6 @@ query {
}
]]

local function escape_char(string)
local escaped, _ = string.gsub(string, '["\\]', {
['"'] = '\\"',
["\\"] = "\\\\",
})
return escaped
end

return function(query, ...)
local opts = { escape = true }
for _, v in ipairs { ... } do
Expand All @@ -3245,13 +3237,9 @@ return function(query, ...)
break
end
end
local escaped = {}
local args = {}
for _, v in ipairs { ... } do
if type(v) == "string" and opts.escape then
table.insert(escaped, escape_char(v))
else
table.insert(escaped, v)
end
table.insert(args, v)
end
return string.format(M[query], unpack(escaped))
return string.format(M[query], unpack(args))
end

0 comments on commit a0adb2a

Please sign in to comment.