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 default file name for make a copy #4618

Merged
merged 1 commit into from
Jul 13, 2019
Merged

Conversation

vibvibgyor
Copy link
Contributor

If a copy of notebook is created using File>Make a Copy..., the default filename is copied after partitioning the filename by dot (.) and appending -Copy1 (for the first copy) to the name of the file as shown in the picture below. In case, a filename itself contains dot (.), then it will partition from left instead of the right dot(.). I have fixed this issue by partitioning from the right side instead of the left which is more logical. I have attached the screenshots for the same.

Original file:
before

On making a copy of the notebook (before fix):
before_1

On making a copy of the notebook (after fix):
after

@vibvibgyor
Copy link
Contributor Author

I beleive that it is more intuitive to have 'Copy' part at the last of the filename. If I have many copies of the notebook in the same folder, it is easier for me to find the right one to open if 'Copy' part is at the last of a filename.

@vibvibgyor
Copy link
Contributor Author

I have just seen that the test cases are failing on the problem where I made change. We would also need to rewrite the test cases according.

@takluyver
Copy link
Member

I think it's deliberately using the left-most dot to account for multi-part extensions like .tar.gz, hence why there are tests for it. The same code is used for all types of files, not just notebooks.

Unfortunately, I don't think there's any good general-way to know which part of a filename should be considered the extension.

@vibvibgyor
Copy link
Contributor Author

@takluyver Since, many of my colleagues and friends have felt similar problem, how about using separate code in case of .ipynb files only as we deal with mostly notebooks in Jupyter environment?

I can make changes, if you are interested.

@takluyver
Copy link
Member

takluyver commented Jun 23, 2019 via email

@vibvibgyor
Copy link
Contributor Author

Thanks @takluyver for your approval. I have made the suggested changes.

@takluyver takluyver added this to the 6.0 milestone Jul 13, 2019
@takluyver takluyver merged commit 70d74d2 into jupyter:master Jul 13, 2019
@takluyver
Copy link
Member

Thanks

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.

None yet

2 participants