mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-06 11:35:24 +08:00
use existing extension in ensure_extension
rather than assuming extension is .ipynb
This commit is contained in:
parent
84f3fe647f
commit
925da82353
@ -2101,8 +2101,9 @@ define(function (require) {
|
||||
* Returns the filename with the appropriate extension, appending if necessary.
|
||||
*/
|
||||
Notebook.prototype.ensure_extension = function (name) {
|
||||
if (!name.match(/\.ipynb$/)) {
|
||||
name = name + ".ipynb";
|
||||
var ext = utils.splitext(this.notebook_path)[1];
|
||||
if (ext.length && name.slice(-ext.length) !== ext) {
|
||||
name = name + ext;
|
||||
}
|
||||
return name;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user