-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
List hidden files if allowed #4328
Conversation
@@ -334,7 +334,7 @@ def _dir_model(self, path, content=True): | |||
self.log.debug("%s not a regular file", os_path) | |||
continue | |||
|
|||
if self.should_list(name) and not is_file_hidden(os_path, stat_res=st): | |||
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) |
There was a problem hiding this comment.
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)
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed!
ping @yuvipanda! Since you asked on gitter I think all that is required is for someone to review and merge this PR. |
Thanks! |
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.