mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-03 03:41:14 +08:00
changed default filename for a copied notebook (#4618)
This commit is contained in:
parent
bd66c18b4f
commit
70d74d21ac
@ -331,7 +331,10 @@ class ContentsManager(LoggingConfigurable):
|
||||
"""
|
||||
# Extract the full suffix from the filename (e.g. .tar.gz)
|
||||
path = path.strip('/')
|
||||
basename, dot, ext = filename.partition('.')
|
||||
basename, dot, ext = filename.rpartition('.')
|
||||
if ext != 'ipynb':
|
||||
basename, dot, ext = filename.partition('.')
|
||||
|
||||
suffix = dot + ext
|
||||
|
||||
for i in itertools.count():
|
||||
@ -425,6 +428,8 @@ class ContentsManager(LoggingConfigurable):
|
||||
|
||||
If to_path not specified, it will be the parent directory of from_path.
|
||||
If to_path is a directory, filename will increment `from_path-Copy#.ext`.
|
||||
Considering multi-part extensions, the Copy# part will be placed before the first dot for all the extensions except `ipynb`.
|
||||
For easier manual searching in case of notebooks, the Copy# part will be placed before the last dot.
|
||||
|
||||
from_path must be a full path to a file.
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user