From c94e6f34d74038756ae9dfcb6366257c514bdf96 Mon Sep 17 00:00:00 2001 From: Brian Granger Date: Mon, 23 Jan 2012 15:36:01 -0800 Subject: [PATCH] Disallow empty notebook names. --- IPython/frontend/html/notebook/static/js/savewidget.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/IPython/frontend/html/notebook/static/js/savewidget.js b/IPython/frontend/html/notebook/static/js/savewidget.js index 9688a31de..e93493f85 100644 --- a/IPython/frontend/html/notebook/static/js/savewidget.js +++ b/IPython/frontend/html/notebook/static/js/savewidget.js @@ -75,8 +75,8 @@ var IPython = (function (IPython) { var new_name = $(this).find('input').attr('value'); if (!that.test_notebook_name(new_name)) { $(this).find('h3').html( - "Invalid notebook name. " + - "Notebook names can contain any characters " + + "Invalid notebook name. Notebook names must "+ + "have 1 or more characters and can contain any characters " + "except / and \\. Please enter a new notebook name:" ); } else { @@ -131,7 +131,8 @@ var IPython = (function (IPython) { SaveWidget.prototype.test_notebook_name = function (nbname) { - if (this.notebook_name_blacklist_re.test(nbname) == false) { + nbname = nbname || ''; + if (this.notebook_name_blacklist_re.test(nbname) == false && nbname.length>0) { return true; } else { return false;