diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c1697e3c..35d25cb0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +1.3.4+dev (2020-03-??) +---------------------- + +**Fixed** +- Removed leading slash in notebook paths (#444) + + 1.3.4 (2020-02-18) ------------------ diff --git a/jupytext/contentsmanager.py b/jupytext/contentsmanager.py index 8936cfccd..cee9b9ae2 100644 --- a/jupytext/contentsmanager.py +++ b/jupytext/contentsmanager.py @@ -213,6 +213,7 @@ def save(self, model, path=''): if model['type'] != 'notebook': return super(JupytextContentsManager, self).save(model, path) + path = path.strip('/') nbk = model['content'] try: metadata = nbk.get('metadata') @@ -284,7 +285,9 @@ def save(self, model, path=''): def get(self, path, content=True, type=None, format=None, load_alternative_format=True): """ Takes a path for an entity and returns its model""" - os_path = self._get_os_path(path.strip('/')) + path = path.strip('/') + + os_path = self._get_os_path(path) ext = os.path.splitext(path)[1] # Not a notebook? diff --git a/tests/test_paired_paths.py b/tests/test_paired_paths.py index 57b4ba6d9..a25ded97d 100644 --- a/tests/test_paired_paths.py +++ b/tests/test_paired_paths.py @@ -67,7 +67,7 @@ def test_prefix_on_root_174(): formats = long_form_multiple_formats(short_formats) assert short_form_multiple_formats(formats) == short_formats - expected_paths = ['/Untitled.ipynb', '/python/Untitled.py'] + expected_paths = ['Untitled.ipynb', 'python/Untitled.py'] for fmt, path in zip(formats, expected_paths): compare(paired_paths(path, fmt, formats), list(zip(expected_paths, formats)))