Skip to content

Conversation

MathisRosenhauer
Copy link
Contributor

A symlink pointing to a directory where you have no access permissions will result in a 404 for the entire directory containing the symlink.
This could also be fixed in FileContentsManager._dir_model() but I don't know what the implications on Windows would be.

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!

@minrk minrk merged commit 459b92c into jupyter:master May 24, 2018
@minrk minrk added this to the 5.6 milestone Jun 15, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 31, 2021
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.

2 participants