Skip to content

Conversation

@maxmouchet
Copy link
Contributor

@maxmouchet maxmouchet commented Jan 8, 2019

This is an attempt to fix #3812 and jupyterlab/jupyterlab#2049.

If the listing of hidden files and directory is allowed, then we return them in the api/contents/: call so that they are displayed in the file manager of the notebook and lab interfaces.

I am not sure about the code style. Feel free to suggest a better way, if any.

if self.should_list(name) and ((not is_file_hidden(os_path, stat_res=st)) or self.allow_hidden):
contents.append(self.get(
path='%s/%s' % (path, name),
content=False)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic might be clearer split over a couple of lines:

if self.should_list(name):
    if self.allow_hidden or not is_file_hidden(os_path, stat_res=st):
        contents.append(
            self.get(path='%s/%s' % (path, name), content=False)
        )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed!

@dhirschfeld
Copy link
Contributor

ping @yuvipanda!

Since you asked on gitter I think all that is required is for someone to review and merge this PR.

@minrk minrk added this to the 5.8 milestone Feb 25, 2019
@minrk minrk merged commit 6d15e9c into jupyter:master Feb 25, 2019
@minrk
Copy link
Member

minrk commented Feb 25, 2019

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] List hidden files if ContentsManager.allow_hidden=True

3 participants