mattn / vim-gist

Vim plugin for Gist
http://www.vim.org/scripts/script.php?script_id=2423
1.69k stars 131 forks source link

Error 'Post failed: Continue' even though Gist was actually published #205

Closed sloria closed 8 years ago

sloria commented 8 years ago

On Vim 7.4.1707 with the latest gist-vim (as of this writing), I am getting an error every time I run :Gist that reads

Post failed: Continue

Consequently, let g:gist_open_browser_after_post = 1 does not work.

However, the Gists actually get posted successfully.

Any ideas?

mkozjak commented 8 years ago

Same for neovim 0.1.3.

mattn commented 8 years ago

are you using gist.vim over http proxy?

mkozjak commented 8 years ago

Nope, but something strange just happened. I've tried adding a new private gist just now (after restarting neovim) and it worked... It printed the link...

m9 commented 8 years ago

Having same issue full vim version information available here

mattn commented 8 years ago

Could you please upgrade webapi-vim?

mkozjak commented 8 years ago

I already have the latest version and managed to get the error with ':Gist -p' just now.

mattn commented 8 years ago

Could you please apply following patch to debug this issue?

diff --git a/autoload/webapi/http.vim b/autoload/webapi/http.vim
index f7b9eb2..123768e 100644
--- a/autoload/webapi/http.vim
+++ b/autoload/webapi/http.vim
@@ -159,6 +159,7 @@ function! webapi#http#get(url, ...) abort
     throw "require `curl` or `wget` command"
   endif
   if follow != 0
+    let g:debug = res
     while res =~ '^HTTP/1.\d 3' || res =~ '^HTTP/1\.\d 200 Connection established' || res =~ '^HTTP/1\.\d 100 Continue'
       let pos = stridx(res, "\r\n\r\n")
       if pos != -1
  1. Apply patch above.
  2. Gist -p
  3. :echo debug

Note that please don't paste secret contents on here.

mkozjak commented 8 years ago
E121: Undefined variable: debug
E15: Invalid expression: debug

Using latest neovim with vim-plug on OS X.

mattn commented 8 years ago

Maybe fixed. Could you please try latest webapi-vim.

mkozjak commented 8 years ago

Installed the update. Same issue.

mattn commented 8 years ago

try to put let g:debug = res on https://github.com/mattn/webapi-vim/blob/master/autoload/webapi/http.vim#L243

eiginn commented 8 years ago

Here's an example Gist I made from vim: https://gist.github.com/eiginn/66abf9416e91bf0e8750ebee13f518f4 debug contents: https://gist.github.com/eiginn/82409aacb4fe3f62e5431d76f4182845

mattn commented 8 years ago

Today, I updated webapi-vim. could you please try latest?

eiginn commented 8 years ago

could be related to vim-plug, i nuked and re cloned the repo in the right place and its working. previously git log only showed last commit about curl workaround and nothing else

mkozjak commented 8 years ago

Updated. Worked for the first paste. Then I tried to paste again with Gist -p and it failed with:

Updating gist...                                                                                                                                                       
Post failed: Not Found
mattn commented 8 years ago

I just run :Gist -p twice.

https://gist.github.com/mattn/e25be0af84ee34d14a5ad090cffae5fc

https://gist.github.com/mattn/e25be0af84ee34d14a5ad090cffae5fc/revisions

But no errors.

enkeyz commented 8 years ago

Same error here with vim.

mattn commented 8 years ago

@enkeyz do you use latest gist-vim and webapi-vim?

mkozjak commented 8 years ago

@mattn I did PlugUpdate before testing.

mattn commented 8 years ago

@mkozjak could you please try https://github.com/mattn/gist-vim/issues/205#issuecomment-214230465 ?

enkeyz commented 8 years ago

@mattn Yes, I'm using latest of everything.

conrman commented 8 years ago

+1 on this issue as well. NeoVim 0.1.4 using vim-plug.

JLoureir0 commented 8 years ago

+1, using neovim 0.1.5

The gist gets posted even with the error. However if i select just a small amount of lines and run :'<,'>Gist there is no error and the plugin behaves as expected.

mattn commented 8 years ago

I don't reproduce this after I fixed webapi-vim in few days ago.

tombeynon commented 8 years ago

Seeing the same thing with NeoVim 0.1.4 using vim-plug (all versions latest). Seems to only occur when posting to Gist, but does happen on both create and updating.

mattn commented 8 years ago

This is my gist that I did :Gist and :w after opening gist from :Gist -l.

https://gist.github.com/mattn/a0158a1b46da3a52cb576a6ff99ebffd/revisions

AFAICS, no problem.

tombeynon commented 8 years ago

It works fine if I only save a very small gist (e.g. by visual selecting a line and :'<,'>Gist, as per @JLoureir0's comment), so your example works fine @mattn. The error seems to appear when you save larger gists - in my case it failed when I tried to save over 20 lines.

mkozjak commented 8 years ago

@tombeynon +1

mattn commented 8 years ago

This is a gist I just post https://gist.github.com/mattn/318aa07ee9cee4c47984cdb7c27c6d69/revisions

6498 lines.

mattn commented 8 years ago

And this is one that :<,>Gist of mbyte.c

https://gist.github.com/mattn/dadb18fc63ff457acc89b37878d23553

JLoureir0 commented 8 years ago

With Vim 7.4.1707 the behavior is exactly the same as NeoVim, it post to Github but it gives out the error unless the amount of data on the gist is really small.

My version of curl is 7.48.0

tombeynon commented 8 years ago

I can reproduce in Vim 7.3 using this minimal vimrc, and this content.

vim -u test-vimrc
// create test file, didn't save
:Gist

As mentioned it does actually save (that gist I linked to is the result of getting that error), and doesn't seem to happen with smaller files.

screen shot 2016-05-11 at 12 17 09
JLoureir0 commented 8 years ago

@mattn:

try to put let g:debug = res on https://github.com/mattn/webapi-vim/blob/master/autoload/webapi/http.vim#L243

Here is the :echo debug result: https://gist.github.com/JLoureir0/f626c723a61d12b687772519fe3f0864#file-t-txt

mattn commented 8 years ago

Succeeded.

https://gist.github.com/fb18979882303f19298749fc06b5bce1

mattn commented 8 years ago

Maybe this part doesn't work expected.

https://github.com/mattn/webapi-vim/blob/master/autoload/webapi/http.vim#L243

mattn commented 8 years ago

Someone, could you please try following?

  1. download this
  2. save aa.vim in same directory
  3. :so aa.vim
JLoureir0 commented 8 years ago

Output for aa.vim https://gist.github.com/JLoureir0/eff71cbb30c7e827cc23d5dab9c8d90a#file-aa_output

mattn commented 8 years ago

Strange. Then your gist-vim or webapi-vim should work well.

mattn commented 8 years ago

Many thanks to responses for this.

I figure out that some version of curl return response that contains strange \r.

tombeynon commented 8 years ago

Thanks for the getting to the bottom of it @mattn - working great now.

mkozjak commented 8 years ago

Working good, thanks!

JLoureir0 commented 8 years ago

Thanks for the fix @mattn. Working great again.

mblarsen commented 8 years ago

Still getting (:Gist):

Posting it to gist...
Post failed: Not Found
Press ENTER or type command to continue

No operations are working except for when I set:

let g:gist_post_anonymous = 1

Note that :Gist -l is working so it is not an issue with my user.

MacVim Both plugins updated just now Using token in ~/.gist-vim

mattn commented 8 years ago

@mblarsen did you try with latest gist-vim and webapi-vim ?

mblarsen commented 8 years ago

@mattn I ran an update with vundle's :PluginUpdate should I update manually to get the latest? Note that I can read gists but I cannot post unless anonymous.

mblarsen commented 8 years ago

@mattn Just tried checking out both repos. It made no difference. I can post as anonymous only, but I can connect to github and get my gists. I cannot save them after making changes.

mblarsen commented 8 years ago

@mattn my apologies, it turns out that my two-factor token didn't have gist access.

mattn commented 8 years ago

:)