From 1b2e41eea48b473bfdb996e2d5b2d95d1582581c Mon Sep 17 00:00:00 2001 From: Zachary Sailer Date: Thu, 25 Jul 2013 12:35:43 -0700 Subject: [PATCH] path with spaces completely fixed --- IPython/html/notebook/handlers.py | 5 ++--- IPython/html/static/notebook/js/main.js | 1 + IPython/html/static/notebook/js/notebook.js | 1 + IPython/html/static/tree/js/notebooklist.js | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/IPython/html/notebook/handlers.py b/IPython/html/notebook/handlers.py index 1fe0d08f3..086740005 100644 --- a/IPython/html/notebook/handlers.py +++ b/IPython/html/notebook/handlers.py @@ -52,15 +52,14 @@ class NamedNotebookHandler(IPythonHandler): nbm = self.notebook_manager name, path = nbm.named_notebook_path(notebook_path) if name != None: - name = quote(name) + name = nbm.url_encode(name) if path == None: project = self.project + '/' + name else: project = self.project + '/' + path +'/'+ name + path = nbm.url_encode(path) if not nbm.notebook_exists(notebook_path): raise web.HTTPError(404, u'Notebook does not exist: %s' % name) - path = nbm.url_encode(path) - name = nbm.url_encode(name) self.write(self.render_template('notebook.html', project=project, notebook_path=path, diff --git a/IPython/html/static/notebook/js/main.js b/IPython/html/static/notebook/js/main.js index 999c01da1..d273bd181 100644 --- a/IPython/html/static/notebook/js/main.js +++ b/IPython/html/static/notebook/js/main.js @@ -50,6 +50,7 @@ function (marked) { var notebookPath = $('body').data('notebookPath'); var notebookName = $('body').data('notebookName'); notebookName = decodeURIComponent(notebookName); + notebookPath = decodeURIComponent(notebookPath); console.log(notebookName); if (notebookPath == 'None'){ notebookPath = ""; diff --git a/IPython/html/static/notebook/js/notebook.js b/IPython/html/static/notebook/js/notebook.js index cc8fac172..dde4d93f5 100644 --- a/IPython/html/static/notebook/js/notebook.js +++ b/IPython/html/static/notebook/js/notebook.js @@ -85,6 +85,7 @@ var IPython = (function (IPython) { Notebook.prototype.notebookPath = function() { var path = $('body').data('notebookPath'); + path = decodeURIComponent(path); if (path != 'None') { if (path[path.length-1] != '/') { path = path.substring(0,path.length); diff --git a/IPython/html/static/tree/js/notebooklist.js b/IPython/html/static/tree/js/notebooklist.js index 257a78df7..d95cc309c 100644 --- a/IPython/html/static/tree/js/notebooklist.js +++ b/IPython/html/static/tree/js/notebooklist.js @@ -28,6 +28,7 @@ var IPython = (function (IPython) { NotebookList.prototype.notebookPath = function() { var path = $('body').data('notebookPath'); + path = decodeURIComponent(path); if (path != "") { if (path[path.length-1] != '/') { path = path.substring(0,path.length);