Check if path is protocol supported by netrw

References #87
pull/88/head v2.0.8
Marco Hinz 6 years ago
parent 81bfe645e6
commit 8254861659
No known key found for this signature in database
GPG Key ID: 1C980A1B657B4A4F

@ -85,8 +85,10 @@ class Nvr():
self.server.funcs.append('$', line.rstrip())
self.server.command('silent 1delete _ | set nomodified')
def fnameescaped_command(self, cmd, fname):
path = self.server.funcs.fnameescape(fname)
def fnameescaped_command(self, cmd, path):
if not is_netrw_protocol(path):
path = os.path.abspath(path)
path = self.server.funcs.fnameescape(path)
self.server.command('{} {}'.format(cmd, path))
def diffthis(self):
@ -139,6 +141,21 @@ class Nvr():
return len(files)
def is_netrw_protocol(path):
protocols = [
re.compile('^davs?://*'),
re.compile('^file://*'),
re.compile('^ftp://*'),
re.compile('^https?://*'),
re.compile('^rcp://*'),
re.compile('^rsync://*'),
re.compile('^scp://*'),
re.compile('^sftp://*'),
]
return True if any(prot.match(path) for prot in protocols) else False
def sanitize_address(address):
if get_address_type(address) == 'socket' and os.path.exists(address):
try:

@ -19,7 +19,7 @@ setup(
'console_scripts': ['nvr = nvr.nvr:main']
},
packages = ['nvr'],
version = '2.0.7',
version = '2.0.8',
license = 'MIT',
keywords = 'neovim nvim nvr remote helper',
classifiers = [

Loading…
Cancel
Save