diff --git a/IPython/html/services/contents/manager.py b/IPython/html/services/contents/manager.py
index c618944..06edfcc 100644
--- a/IPython/html/services/contents/manager.py
+++ b/IPython/html/services/contents/manager.py
@@ -347,6 +347,9 @@ class ContentsManager(LoggingConfigurable):
from_path must be a full path to a file.
"""
path = from_path.strip('/')
+ if to_path is not None:
+ to_path = to_path.strip('/')
+
if '/' in path:
from_dir, from_name = path.rsplit('/', 1)
else: