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 rename_file and delete_file to handle hidden files properly #1073

Merged

Conversation

yacchin1205
Copy link
Contributor

In working on the Pull Request jupyter/notebook#6609 , I found that the tests for hidden files was broken, so that I fixed the tests and found more problems to fix.

Some mistakes regarding the tests are as follows (for example, see test_400 intests/services/contents/test_manager.py https://github.com/jupyter-server/jupyter_server/blob/main/tests/services/contents/test_manager.py#L329-L342 ):

  • There is the try ... except in with pytest.raises(HTTPError) , but actually the exception is raised by the cm.new before the try and never performs the rename_file.
  • The old_path or new_path is set to the return value of cm._get_os_path() (it seems an absolute path), but I assume that rename_file and delete_file expects relative paths.

When I fixed the test, I found the following new problems:

  • In AsyncFileContentsManager rename_file and delete_file, it is not checked if a path is a hidden file or not.
  • In FileContentsManager delete_file, the existence check has been made before determining whether the file is hidden.(This looks like the hidden check should be done first, as seen in rename_file).

So I also fixed these problems.

@welcome
Copy link

welcome bot commented Nov 18, 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
Copy link

codecov bot commented Nov 18, 2022

Codecov Report

Base: 75.69% // Head: 75.69% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (6958baa) compared to base (28577cf).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1073      +/-   ##
==========================================
- Coverage   75.69%   75.69%   -0.01%     
==========================================
  Files          63       63              
  Lines        8222     8226       +4     
  Branches     1634     1636       +2     
==========================================
+ Hits         6224     6227       +3     
- Misses       1572     1574       +2     
+ Partials      426      425       -1     
Impacted Files Coverage Δ
jupyter_server/services/contents/filemanager.py 72.62% <100.00%> (+0.99%) ⬆️
jupyter_server/services/kernels/handlers.py 61.61% <0.00%> (-1.02%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Collaborator

@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.

Thank you!

@blink1073 blink1073 merged commit 908e843 into jupyter-server:main Nov 18, 2022
@welcome
Copy link

welcome bot commented Nov 18, 2022

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

@blink1073
Copy link
Collaborator

@meeseeksdev please backport to 1.x

meeseeksmachine pushed a commit to meeseeksmachine/jupyter_server that referenced this pull request Nov 18, 2022
blink1073 pushed a commit that referenced this pull request Nov 18, 2022
…andle hidden files properly) (#1075)

Co-authored-by: Satoshi Yazawa <yazawa@yzwlab.net>
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.

None yet

2 participants