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

Strict https or ssh #448

Merged
merged 15 commits into from
Nov 15, 2015
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ Neobundle features: Early development (may break compatibility), very complex,
good for plugin power users (for example, 50+ plugins and over 1000 lines
.vimrc, ...)

Note: Neobunle only accepts "https" or "ssh".
https://glyph.twistedmatrix.com/2015/11/editor-malware.html

## How it works

Plugins are defined in NeoBundle by calling `NeoBundle '<plugin repository
Expand Down
157 changes: 0 additions & 157 deletions autoload/neobundle/sources/vim_scripts_org.vim

This file was deleted.

9 changes: 8 additions & 1 deletion autoload/neobundle/types/git.vim
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ function! s:type.detect(path, opts) "{{{
\ g:neobundle#types#git#default_protocol)
endif

if protocol !=# 'https' && protocol !=# 'ssh'
call neobundle#util#print_error(
\ 'The protocol "' . protocol .
\ '"is invalid. Please use https or ssh instead.')
return {}
endif

if a:path !~ '/'
" www.vim.org Vim scripts.
let name = split(a:path, ':')[-1]
Expand Down Expand Up @@ -213,7 +220,7 @@ function! s:parse_other_pattern(protocol, path, opts) "{{{
let uri = (a:protocol ==# 'ssh') ?
\ 'git@gist.github.com:' . split(name, '/')[-1] :
\ a:protocol . '://gist.github.com/'. split(name, '/')[-1]
elseif a:path =~# '\<\%(git@\|git://\)\S\+'
elseif a:path =~# '\<git@\S\+'
\ || a:path =~# '\.git\s*$'
\ || get(a:opts, 'type', '') ==# 'git'
if a:path =~# '\<\%(bb\|bitbucket\):\S\+'
Expand Down
10 changes: 8 additions & 2 deletions autoload/neobundle/types/hg.vim
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,21 @@ function! s:type.detect(path, opts) "{{{
\ g:neobundle#types#hg#default_protocol)
endif

if protocol !=# 'https' && protocol !=# 'ssh'
call neobundle#util#print_error(
\ 'The protocol "' . protocol .
\ '"is invalid. Please use https or ssh instead.')
return {}
endif

if a:path =~# '\<\%(bb\|bitbucket\):'
let name = substitute(split(a:path, ':')[-1],
\ '^//bitbucket.org/', '', '')
let uri = (protocol ==# 'ssh') ?
\ 'ssh://hg@bitbucket.org/' . name :
\ protocol . '://bitbucket.org/' . name
elseif a:path =~? '[/.]hg[/.@]'
\ || (a:path =~# '\<https\?://bitbucket\.org/'
\ || a:path =~# '\<https://code\.google\.com/'
\ || (a:path =~# '\<https://bitbucket\.org/'
\ || get(a:opts, 'type', '') ==# 'hg')
let uri = a:path
else
Expand Down
6 changes: 3 additions & 3 deletions autoload/neobundle/types/raw.vim
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ function! s:type.detect(path, opts) "{{{
let type = ''
let name = ''

if a:path =~# '^https\?:.*\.vim$'
" HTTP/HTTPS
if a:path =~# '^https:.*\.vim$'
" HTTPS

let name = neobundle#util#name_conversion(a:path)

let type = 'raw'
elseif a:path =~#
\ '^https\?://www\.vim\.org/scripts/download_script.php?src_id=\d\+$'
\ '^https://www\.vim\.org/scripts/download_script.php?src_id=\d\+$'
" For www.vim.org
let name = 'vim-scripts-' . matchstr(a:path, '\d\+$')
let type = 'raw'
Expand Down
7 changes: 4 additions & 3 deletions autoload/neobundle/types/svn.vim
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ function! s:type.detect(path, opts) "{{{
let name = ''
let uri = ''

if a:path =~# '\<\%(file\|https\?\|svn\)://'
\ && a:path =~? '[/.]svn[/.]'
if (a:path =~# '\<\%(file\|https\)://'
\ && a:path =~? '[/.]svn[/.]')
\ || a:path =~# '\<svn+ssh://'
let uri = a:path
let type = 'svn'
elseif a:path =~# '\<\%(gh\|github\):\S\+\|://github.com/'
elseif a:path =~# '\<\%(gh\|github\):\S\+\|https://github.com/'
let name = substitute(split(a:path, ':')[-1],
\ '^//github.com/', '', '')
let uri = 'https://github.com/'. name
Expand Down
7 changes: 4 additions & 3 deletions autoload/neobundle/types/vba.vim
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ function! s:type.detect(path, opts) "{{{
let type = ''
let name = ''

if a:path =~# '^https\?:.*\.vba\(\.gz\)\?$'
" HTTP / HTTPS
if a:path =~# '^https:.*\.vba\(\.gz\)\?$'
" HTTPS
" .*.vba / .*.vba.gz
let name = fnamemodify(split(a:path, ':')[-1], ':s?/$??:t:s?\c\.vba\(\.gz\)*\s*$??')
let name = fnamemodify(split(a:path, ':')[-1],
\ ':s?/$??:t:s?\c\.vba\(\.gz\)*\s*$??')
let type = 'vba'
endif

Expand Down
Loading