image.nvim icon indicating copy to clipboard operation
image.nvim copied to clipboard

Ability to supply headers/modify the http request to fetch remote images

Open dlvhdr opened this issue 1 year ago • 2 comments

Hi, thanks for the plugin. I'm using octo.nvim to do code reviews and it presents the summary of the PR in neovim. I would like to view the images in neovim as well. These images are stored in a private github repo that I have access to, using my cookie/token. Would it be possible to supply these when this plugin fetches the images? Something like gh auth token will give me my github token that I can then supply this plugin with to fetch the remote images.

Thank you!

dlvhdr avatar Jun 08 '24 15:06 dlvhdr

Hey, would it be enough to make the arguments we send to curl configurable so you can pass --header?

3rd avatar Jun 08 '24 19:06 3rd

So did more research and apparently github makes it really hard. They require both session cookie and a token. They then redirect to s3. Makes it very hard to just use gh auth token

dlvhdr avatar Jun 13 '24 17:06 dlvhdr

Closing, please re-open if you think we need to add custom options to how we fetch remote images.

3rd avatar Nov 09 '24 21:11 3rd

@3rd thanks for the great plugin!

i got this error when hovering the URL of image that i uploaded to imgbb

Error executing callback:
...site/pack/deps/opt/image.nvim/lua/image/utils/logger.lua:54: 09:03:19.027907 [image.nvim] image: curl errored while downloading https://i.ibb.co/vxvZt2bh/f673dc87f347.png {
  code = 7,
  signal = 0
}
stack traceback:
        [C]: in function 'handler'
        ...site/pack/deps/opt/image.nvim/lua/image/utils/logger.lua:54: in function 'throw'
        ...e/nvim/site/pack/deps/opt/image.nvim/lua/image/image.lua:383: in function <...e/nvim/site/pack/deps/opt/image.nvim/lua/image/image.lua:381>

rvyhvn avatar Jun 13 '25 01:06 rvyhvn