Skip to content

Commit

Permalink
Directories are not notebooks
Browse files Browse the repository at this point in the history
Fixes  #228
  • Loading branch information
mwouts committed May 15, 2019
1 parent 662784c commit e98a526
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
Release History
---------------

1.1.2 (2019-05-15)
++++++++++++++++++++++

**BugFixes*
- Directories ending in .jl (or .ipynb) are not notebooks (#228)


1.1.1 (2019-04-16)
++++++++++++++++++++++

Expand Down
4 changes: 3 additions & 1 deletion jupytext/contentsmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,12 @@ 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"""
path = path.strip('/')
os_path = self._get_os_path(path)
ext = os.path.splitext(path)[1]

# Not a notebook?
if not self.exists(path) or (type != 'notebook' if type else ext not in self.all_nb_extensions()):
if (not self.exists(path) or os.path.isdir(os_path) or
(type != 'notebook' if type else ext not in self.all_nb_extensions())):
return super(TextFileContentsManager, self).get(path, content, type, format)

fmt = preferred_format(ext, self.preferred_jupytext_formats_read)
Expand Down

0 comments on commit e98a526

Please sign in to comment.