Skip to content
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

Fix the non-writable path deletion error #670

Merged
merged 1 commit into from
Jan 25, 2022

Conversation

vkaidalov
Copy link
Contributor

Hi everyone!

I noticed that I got the "Delete Failed: Unhandled error" message in the error dialog when I tried to delete either a read-only file or a read-only directory. In contrast, the message was "Permission denied" in JupyterLab 1.x, so I decided to take a look at the code.

As the result, I found out that this issue had already been identified in the comments. Given that the "easier to ask for forgiveness than permission" approach cannot be used there because of send2trash's errors ambiguity, I propose to "look before you leap" to fix this issue.

Could you please review the PR? It should make the server return 403 instead of 500 and also make JupyterLab show the "Permission denied" message instead of the "Unhandled error" text. I've also moved the permissions check code to a separate new method.

@welcome
Copy link

welcome bot commented Jan 19, 2022

Thanks for submitting your first pull request! You are awesome! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please make sure you followed the pull request template, as this will help us review your contribution more quickly.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also a intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@codecov-commenter
Copy link

codecov-commenter commented Jan 19, 2022

Codecov Report

Merging #670 (6a5bf05) into main (db46446) will increase coverage by 0.49%.
The diff coverage is 53.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #670      +/-   ##
==========================================
+ Coverage   77.88%   78.38%   +0.49%     
==========================================
  Files         110      110              
  Lines       10405    10696     +291     
  Branches     1400     1441      +41     
==========================================
+ Hits         8104     8384     +280     
- Misses       1911     1916       +5     
- Partials      390      396       +6     
Impacted Files Coverage Δ
jupyter_server/services/contents/filemanager.py 70.22% <53.33%> (-0.34%) ⬇️
jupyter_server/pytest_plugin.py 84.89% <0.00%> (-0.09%) ⬇️
jupyter_server/tests/services/sessions/test_api.py 98.10% <0.00%> (-0.06%) ⬇️
jupyter_server/tests/services/kernels/test_cull.py 100.00% <0.00%> (ø)
jupyter_server/tests/services/kernels/test_api.py 96.22% <0.00%> (+0.22%) ⬆️
jupyter_server/utils.py 66.47% <0.00%> (+0.56%) ⬆️
jupyter_server/nbconvert/handlers.py 25.00% <0.00%> (+0.72%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update db46446...6a5bf05. Read the comment docs.

@Zsailer Zsailer added the bug label Jan 19, 2022
Copy link
Contributor

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@blink1073
Copy link
Contributor

Kicking CI

@blink1073 blink1073 closed this Jan 24, 2022
@blink1073 blink1073 reopened this Jan 24, 2022
@Zsailer
Copy link
Member

Zsailer commented Jan 24, 2022

Kicking CI one more time after #669

@blink1073
Copy link
Contributor

Kicking to pick up windows skips

@blink1073 blink1073 closed this Jan 25, 2022
@blink1073 blink1073 reopened this Jan 25, 2022
@blink1073
Copy link
Contributor

CI failures are unrelated and captured in #677. Thanks again @vkaidalov!

@blink1073 blink1073 merged commit 7615f32 into jupyter-server:main Jan 25, 2022
@welcome
Copy link

welcome bot commented Jan 25, 2022

Congrats on your first merged pull request in this project! 🎉
congrats
Thank you for contributing, we are very proud of you! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants