From 1dadf74c5e70efd7cfe114ea95ccfff3303c3c04 Mon Sep 17 00:00:00 2001 From: Miro Hrončok Date: Apr 11 2017 09:29:03 +0000 Subject: Remove unused patches from git --- diff --git a/0a8096adf165e2465550bd5893d7e352544e5967.patch b/0a8096adf165e2465550bd5893d7e352544e5967.patch deleted file mode 100644 index 62e6c2f..0000000 --- a/0a8096adf165e2465550bd5893d7e352544e5967.patch +++ /dev/null @@ -1,155 +0,0 @@ -From d729ce7c2063c0de746a7c2ea39697040d0af5bf Mon Sep 17 00:00:00 2001 -From: Min RK -Date: Mon, 20 Jul 2015 12:10:10 -0700 -Subject: [PATCH 1/4] set mime-type on /files/ - ---- - IPython/html/files/handlers.py | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/IPython/html/files/handlers.py b/IPython/html/files/handlers.py -index 7727d08..b358d94 100644 ---- a/IPython/html/files/handlers.py -+++ b/IPython/html/files/handlers.py -@@ -40,6 +40,11 @@ def get(self, path): - cur_mime = mimetypes.guess_type(name)[0] - if cur_mime is not None: - self.set_header('Content-Type', cur_mime) -+ else: -+ if model['format'] == 'base64': -+ self.set_header('Content-Type', 'application/octet-stream') -+ else: -+ self.set_header('Content-Type', 'text/plain') - - if model['format'] == 'base64': - b64_bytes = model['content'].encode('ascii') - -From 50a1366a8fcfb94671c87199515ebc922882f447 Mon Sep 17 00:00:00 2001 -From: Min RK -Date: Mon, 20 Jul 2015 12:10:25 -0700 -Subject: [PATCH 2/4] set model mimetype, even when content=False - ---- - IPython/html/services/contents/filemanager.py | 12 +++++++----- - IPython/html/services/contents/handlers.py | 3 --- - 2 files changed, 7 insertions(+), 8 deletions(-) - -diff --git a/IPython/html/services/contents/filemanager.py b/IPython/html/services/contents/filemanager.py -index 01ce07b..c869c75 100644 ---- a/IPython/html/services/contents/filemanager.py -+++ b/IPython/html/services/contents/filemanager.py -@@ -277,18 +277,20 @@ def _file_model(self, path, content=True, format=None): - model['type'] = 'file' - - os_path = self._get_os_path(path) -+ model['mimetype'] = mimetypes.guess_type(os_path)[0] - - if content: - content, format = self._read_file(os_path, format) -- default_mime = { -- 'text': 'text/plain', -- 'base64': 'application/octet-stream' -- }[format] -+ if model['mimetype'] is None: -+ default_mime = { -+ 'text': 'text/plain', -+ 'base64': 'application/octet-stream' -+ }[format] -+ model['mimetype'] = default_mime - - model.update( - content=content, - format=format, -- mimetype=mimetypes.guess_type(os_path)[0] or default_mime, - ) - - return model -diff --git a/IPython/html/services/contents/handlers.py b/IPython/html/services/contents/handlers.py -index 5cd849e..d77e70e 100644 ---- a/IPython/html/services/contents/handlers.py -+++ b/IPython/html/services/contents/handlers.py -@@ -52,9 +52,6 @@ def validate_model(model, expect_content): - ) - - maybe_none_keys = ['content', 'format'] -- if model['type'] == 'file': -- # mimetype should be populated only for file models -- maybe_none_keys.append('mimetype') - if expect_content: - errors = [key for key in maybe_none_keys if model[key] is None] - if errors: - -From df24d9153b86863ccfa98bf509704d9304143ce1 Mon Sep 17 00:00:00 2001 -From: Min RK -Date: Mon, 20 Jul 2015 12:11:04 -0700 -Subject: [PATCH 3/4] only redirect to editor for text documents - -treat unidentified mime-types as text ---- - IPython/html/static/tree/js/notebooklist.js | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/IPython/html/static/tree/js/notebooklist.js b/IPython/html/static/tree/js/notebooklist.js -index 0065143..d8c7b2a 100644 ---- a/IPython/html/static/tree/js/notebooklist.js -+++ b/IPython/html/static/tree/js/notebooklist.js -@@ -532,6 +532,13 @@ define([ - icon = 'running_' + icon; - } - var uri_prefix = NotebookList.uri_prefixes[model.type]; -+ if (model.type === 'file' && -+ model.mimetype && model.mimetype.substr(0,5) !== 'text/' -+ ) { -+ // send text/unidentified files to editor, others go to raw viewer -+ uri_prefix = 'files'; -+ } -+ - item.find(".item_icon").addClass(icon).addClass('icon-fixed-width'); - var link = item.find("a.item_link") - .attr('href', - -From 2b835ca6daec2592d9127dc85bf2cdcfb718edf2 Mon Sep 17 00:00:00 2001 -From: Min RK -Date: Mon, 20 Jul 2015 12:11:23 -0700 -Subject: [PATCH 4/4] Don't redirect from /edit/ to /files/ - -show failure to decode, instead ---- - IPython/html/static/edit/js/editor.js | 15 +++------------ - 1 file changed, 3 insertions(+), 12 deletions(-) - -diff --git a/IPython/html/static/edit/js/editor.js b/IPython/html/static/edit/js/editor.js -index dd12ea4..75d65e0 100644 ---- a/IPython/html/static/edit/js/editor.js -+++ b/IPython/html/static/edit/js/editor.js -@@ -90,19 +90,10 @@ function($, - }).catch( - function(error) { - that.events.trigger("file_load_failed.Editor", error); -- if (((error.xhr||{}).responseJSON||{}).reason === 'bad format') { -- window.location = utils.url_path_join( -- that.base_url, -- 'files', -- that.file_path -- ); -- } else { -- console.warn('Error while loading: the error was:') -- console.warn(error) -- } -+ console.warn('Error loading: ', error); - cm.setValue("Error! " + error.message + - "\nSaving disabled.\nSee Console for more details."); -- cm.setOption('readOnly','nocursor') -+ cm.setOption('readOnly','nocursor'); - that.save_enabled = false; - } - ); -@@ -186,7 +177,7 @@ function($, - Editor.prototype._clean_state = function(){ - var clean = this.codemirror.isClean(this.generation); - if (clean === this.clean){ -- return -+ return; - } else { - this.clean = clean; - } diff --git a/3ab41641cf6fce3860c73d5cf4645aa12e1e5892.patch b/3ab41641cf6fce3860c73d5cf4645aa12e1e5892.patch deleted file mode 100644 index cb04958..0000000 --- a/3ab41641cf6fce3860c73d5cf4645aa12e1e5892.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 3ab41641cf6fce3860c73d5cf4645aa12e1e5892 Mon Sep 17 00:00:00 2001 -From: Matthias Bussonnier -Date: Tue, 1 Sep 2015 16:29:25 +0200 -Subject: [PATCH] Fix XSS reported on Security list -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -No CVE-ID yet - -August 18, 2015 ------ -Reported to Quantopian by Juan Broullón ... - -If you create a new folder in the iPython file browser and set -Javascript code as its name the code injected will be executed. So, if I -create a folder called "> and -then I access to it, the cookies will be prompted. - -The XSS code is also executed if you access a link pointing directly at -the folder. - - jik ------- ---- - IPython/html/notebookapp.py | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/IPython/html/notebookapp.py b/IPython/html/notebookapp.py -index 0464144..094812b 100644 ---- a/IPython/html/notebookapp.py -+++ b/IPython/html/notebookapp.py -@@ -158,7 +158,9 @@ def init_settings(self, ipython_app, kernel_manager, contents_manager, - _template_path = (_template_path,) - template_path = [os.path.expanduser(path) for path in _template_path] - -- jenv_opt = jinja_env_options if jinja_env_options else {} -+ jenv_opt = {"autoescape": True} -+ jenv_opt.update(jinja_env_options if jinja_env_options else {}) -+ - env = Environment(loader=FileSystemLoader(template_path), **jenv_opt) - - sys_info = get_sys_info() diff --git a/ipython-2.1.0-_jsdir-search-path.patch b/ipython-2.1.0-_jsdir-search-path.patch deleted file mode 100644 index 753abc8..0000000 --- a/ipython-2.1.0-_jsdir-search-path.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/IPython/html/notebookapp.py b/IPython/html/notebookapp.py -index 9c555d6..7a73666 100644 ---- a/IPython/html/notebookapp.py -+++ b/IPython/html/notebookapp.py -@@ -443,7 +443,8 @@ def _base_project_url_changed(self, name, old, new): - or overriding individual files in the IPython""" - ) - def _extra_static_paths_default(self): -- return [os.path.join(self.profile_dir.location, 'static')] -+ return [os.path.join(self.profile_dir.location, 'static'), -+ '_jsdir'] - - @property - def static_file_path(self):