Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion notebook/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def is_file_hidden_posix(abs_path, stat_res=None):
if os.path.basename(abs_path).startswith('.'):
return True

if stat_res is None:
if stat_res is None or stat.S_ISLNK(stat_res.st_mode):
Copy link
Member

Choose a reason for hiding this comment

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

This should already be the stat_res for this path, at least according to the docstring. Do you mean to check ISLNK at another location, perhaps after calling realpath?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this case the docstring is wrong because _dir_model() passes the result of an lstat() call. To check if we are allowed to read the directory, we have to follow the symlink, though. That's why I called stat() again on the path.
There seems to be a good reason for using lstat() in _dir_model() (#2574).

Copy link
Member

Choose a reason for hiding this comment

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

Gotcha, I remember that now. Thanks!

try:
stat_res = os.stat(abs_path)
except OSError as e:
Expand Down