From 97263161e4796f03ce4cb0526f4ebbbd873d9231 Mon Sep 17 00:00:00 2001 From: kikocorreoso Date: Tue, 31 Jan 2017 09:31:17 +0100 Subject: [PATCH] fix and tests for the issue related with the trailing slash using 'nbextension install' (see #2069) --- notebook/nbextensions.py | 2 +- notebook/tests/test_nbextensions.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/notebook/nbextensions.py b/notebook/nbextensions.py index 7624422fb..99ae522f8 100644 --- a/notebook/nbextensions.py +++ b/notebook/nbextensions.py @@ -165,7 +165,7 @@ def install_nbextension(path, overwrite=False, symlink=False, full_dest = None else: if not destination: - destination = basename(path) + destination = basename(normpath(path)) destination = cast_unicode_py2(destination) full_dest = normpath(pjoin(nbext, destination)) if overwrite and os.path.lexists(full_dest): diff --git a/notebook/tests/test_nbextensions.py b/notebook/tests/test_nbextensions.py index 624bf4b8d..df4063972 100644 --- a/notebook/tests/test_nbextensions.py +++ b/notebook/tests/test_nbextensions.py @@ -178,6 +178,11 @@ class TestInstallNBExtension(TestCase): install_nbextension(pjoin(self.src, d)) self.assert_installed(self.files[-1]) + def test_single_dir_trailing_slash(self): + d = [u'∂ir/', u'∂ir\\'] + for dest in d: + install_nbextension(pjoin(self.src, dest)) + self.assert_installed(self.files[-1]) def test_destination_file(self): file = self.files[0]