Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move curl body to file #622

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

zeratax
Copy link

@zeratax zeratax commented Sep 23, 2024

On windows I noticed I kept getting ENAMETOOLONG since the curl argument was so long, so I moved the body into a file.
This is a draft since I would def need to do this for the other providers too and the temp path is currently only valid for windows, but I am unsure if this is even the correct direction to go in.

Also I had to use pwsh instead of powershell otherwise the build failed with:

New-TemporaryFile : The term 'New-TemporaryFile' is not recognized as the name of a cmdlet, function, script file, or  operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

- reduce curl argument size to avoid ENAMETOOLONG
- use pwsh instead of powershell
Copy link
Collaborator

@aarnphm aarnphm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think let's try to investigate what leads to this error.

This is very much a hack.

Can you provide a small reproducer?

@@ -122,7 +122,7 @@ M.stream = function(opts)
headers = spec.headers,
proxy = spec.proxy,
insecure = spec.insecure,
body = vim.json.encode(spec.body),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is considered breaking, if the spec doesn't contains a binary body (iiuc that is what body_file is) then this will break for other provider.

return string.format("%x", v)
end)

local body_file_path = string.format("%s\\AppData\\Local\\Temp\\avante_body_%s.json", os.getenv("USERPROFILE"), id)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's not do this, this won't work on linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants