Skip to content

Commit 0da7ebc

Browse files
committed
fix: attempt to resolve a "cookies must be enabled" error
1 parent 0e3585b commit 0da7ebc

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

lua/copilot/lsp_binary.lua

+14-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,15 @@ local function download_file(url, local_server_zip_filepath, local_server_zip_pa
7474
end
7575
end
7676

77-
local cmd = string.format('curl -s -L -o "%s" "%s"', local_server_zip_filepath:gsub("\\", "\\\\"), url)
77+
local cookie_file = vim.fs.joinpath(local_server_zip_path, "cookies.txt")
78+
local cmd = string.format(
79+
'curl -s -L -c "%s" -b "%s" -o "%s" "%s"',
80+
cookie_file:gsub("\\", "\\\\"),
81+
cookie_file:gsub("\\", "\\\\"),
82+
local_server_zip_filepath:gsub("\\", "\\\\"),
83+
url
84+
)
85+
7886
logger.trace("Downloading copilot-language-server with command: " .. cmd)
7987
local result = vim.fn.system(cmd)
8088

@@ -83,6 +91,11 @@ local function download_file(url, local_server_zip_filepath, local_server_zip_pa
8391
return false
8492
end
8593

94+
-- Clean up cookie file
95+
if vim.fn.filereadable(cookie_file) == 1 then
96+
vim.fn.delete(cookie_file)
97+
end
98+
8699
logger.debug("copilot-language-server downloaded to " .. local_server_zip_filepath)
87100
return true
88101
end

0 commit comments

Comments
 (0)