From 883429615dcde5c636c18570a01c74d3936b1762 Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Sun, 1 May 2016 22:53:28 -0500 Subject: [PATCH 1/2] Add PERMITTED_MIMETYPES --- notebook/static/tree/js/notebooklist.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/notebook/static/tree/js/notebooklist.js b/notebook/static/tree/js/notebooklist.js index 1881459cd..6dbf8ffaa 100644 --- a/notebook/static/tree/js/notebooklist.js +++ b/notebook/static/tree/js/notebooklist.js @@ -52,6 +52,10 @@ define([ 'sort-name': 0 }; this._max_upload_size_mb = 25; + this.PERMITTED_MIMETYPES = [ + 'application/javascipt', + 'application/x-sh', + ]; }; NotebookList.prototype.style = function () { @@ -646,9 +650,9 @@ define([ } var uri_prefix = NotebookList.uri_prefixes[model.type]; if (model.type === 'file' && - model.mimetype && model.mimetype.substr(0,5) !== 'text/' - && !model.mimetype.endsWith('javascript') - ) { + model.mimetype && + (model.mimetype.substr(0, 5) !== 'text/' || + PERMITTED_MIMETYPES.indexOf(model.mimetype) < 0)) { // send text/unidentified files to editor, others go to raw viewer uri_prefix = 'files'; } From be7649b873fea6cb6c58d37ca46dd7e14558e764 Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Mon, 2 May 2016 03:01:00 -0500 Subject: [PATCH 2/2] Replaced PERMITTED_MIMETYPES with EDIT_MIMETYPES --- notebook/static/tree/js/notebooklist.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notebook/static/tree/js/notebooklist.js b/notebook/static/tree/js/notebooklist.js index 6dbf8ffaa..db37c3d18 100644 --- a/notebook/static/tree/js/notebooklist.js +++ b/notebook/static/tree/js/notebooklist.js @@ -52,7 +52,7 @@ define([ 'sort-name': 0 }; this._max_upload_size_mb = 25; - this.PERMITTED_MIMETYPES = [ + this.EDIT_MIMETYPES = [ 'application/javascipt', 'application/x-sh', ]; @@ -652,7 +652,7 @@ define([ if (model.type === 'file' && model.mimetype && (model.mimetype.substr(0, 5) !== 'text/' || - PERMITTED_MIMETYPES.indexOf(model.mimetype) < 0)) { + EDIT_MIMETYPES.indexOf(model.mimetype) < 0)) { // send text/unidentified files to editor, others go to raw viewer uri_prefix = 'files'; }