aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python/notebook/files/notebook-4.0.4-set-mime-type-on-files.patch')
-rw-r--r--dev-python/notebook/files/notebook-4.0.4-set-mime-type-on-files.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/dev-python/notebook/files/notebook-4.0.4-set-mime-type-on-files.patch b/dev-python/notebook/files/notebook-4.0.4-set-mime-type-on-files.patch
new file mode 100644
index 000000000..055685f8e
--- /dev/null
+++ b/dev-python/notebook/files/notebook-4.0.4-set-mime-type-on-files.patch
@@ -0,0 +1,35 @@
+Upstream patch to fix
+"Maliciously crafted text files in IPython/Jupyter editor".
+
+http://seclists.org/oss-sec/2015/q3/558
+https://bugs.gentoo.org/show_bug.cgi?id=560708
+
+
+From 6ec427b5234bfc6c97065f130f762aee8ee67df4 Mon Sep 17 00:00:00 2001
+From: Min RK <benjaminrk@gmail.com>
+Date: Mon, 20 Jul 2015 12:10:10 -0700
+Subject: [PATCH 1/4] set mime-type on /files/
+
+---
+ notebook/files/handlers.py | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/notebook/files/handlers.py b/notebook/files/handlers.py
+index def3ec6..9d27261 100644
+--- a/notebook/files/handlers.py
++++ b/notebook/files/handlers.py
+@@ -40,6 +40,11 @@ class FilesHandler(IPythonHandler):
+ 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')
+--
+2.4.6
+