From 7a8aa92b73bc647ea4fefa85932fe02e9435e69e Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Thu, 25 Feb 2016 01:36:34 -0600 Subject: [PATCH] Add same_file check in rename_file --- notebook/services/contents/filemanager.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/notebook/services/contents/filemanager.py b/notebook/services/contents/filemanager.py index d82bba403..34a342462 100644 --- a/notebook/services/contents/filemanager.py +++ b/notebook/services/contents/filemanager.py @@ -25,6 +25,7 @@ from . import tz from notebook.utils import ( is_hidden, to_api_path, + same_file, ) _script_exporter = None @@ -460,7 +461,7 @@ class FileContentsManager(FileManagerMixin, ContentsManager): old_os_path = self._get_os_path(old_path) # Should we proceed with the move? - if os.path.exists(new_os_path): + if os.path.exists(new_os_path) and not same_file(old_os_path, new_os_path): raise web.HTTPError(409, u'File already exists: %s' % new_path) # Move the file