mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-12 11:45:38 +08:00
Clean up logic
This commit is contained in:
parent
e95cd6d820
commit
e1533d5398
@ -327,9 +327,7 @@ class ContentsManager(LoggingConfigurable):
|
||||
"""
|
||||
# Extract the full suffix from the filename (e.g. .tar.gz)
|
||||
path = path.strip('/')
|
||||
dirname, basename = os.path.split(filename)
|
||||
name, dot, ext = basename.partition('.')
|
||||
basename = os.path.join(dirname, name)
|
||||
name, dot, ext = filename.partition('.')
|
||||
suffix = dot + ext
|
||||
|
||||
for i in itertools.count():
|
||||
@ -337,9 +335,9 @@ class ContentsManager(LoggingConfigurable):
|
||||
insert_i = '{}{}'.format(insert, i)
|
||||
else:
|
||||
insert_i = ''
|
||||
name = u'{basename}{insert}{suffix}'.format(basename=basename,
|
||||
name = u'{name}{insert}{suffix}'.format(name=name,
|
||||
insert=insert_i, suffix=suffix)
|
||||
if not self.exists(os.path.join(path, name)):
|
||||
if not self.exists(u'{}/{}'.format(path, name)):
|
||||
break
|
||||
return name
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user