Skip to content

Commit 9442804

Browse files
committed
Merge branch 'jupyter/master'
2 parents 025f753 + 0db816e commit 9442804

File tree

5 files changed

+70
-8
lines changed

5 files changed

+70
-8
lines changed

docs/source/changelog.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,27 @@ For more detailed information, see `GitHub <https://github.com/jupyter/notebook>
1111
Use ``pip install notebook --upgrade`` or ``conda upgrade notebook`` to
1212
upgrade to the latest release.
1313

14+
.. _release-4.2.2:
15+
16+
4.2.2
17+
-----
18+
19+
4.2.2 is a small bugfix release on 4.2, with an important security fix.
20+
All users are strongly encouraged to upgrade to 4.2.2.
21+
22+
Highlights:
23+
24+
- **Security fix**: CVE-2016-6524, where untrusted latex output
25+
could be added to the page in a way that could execute javascript.
26+
- Fix missing POST in OPTIONS responses.
27+
- Fix for downloading non-ascii filenames.
28+
- Avoid clobbering ssl_options, so that users can specify more detailed SSL configuration.
29+
- Fix inverted load order in nbconfig, so user config has highest priority.
30+
- Improved error messages here and there.
31+
32+
.. seealso::
33+
34+
4.2.2 `on GitHub <https://github.com/jupyter/notebook/milestones/4.2.2>`__.
1435

1536
.. _release-4.2.1:
1637

notebook/static/notebook/js/outputarea.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ define([
779779
*/
780780
var type = 'text/latex';
781781
var toinsert = this.create_output_subarea(md, "output_latex", type);
782-
toinsert.append(latex);
782+
toinsert.text(latex);
783783
element.append(toinsert);
784784
return toinsert;
785785
};

notebook/static/notebook/js/textcell.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ define([
2525
ipgfm
2626
) {
2727
"use strict";
28+
function encodeURIandParens(uri){return encodeURI(uri).replace('(','%28').replace(')','%29')}
29+
2830
var Cell = cell.Cell;
2931

3032
var TextCell = function (options) {
@@ -245,9 +247,9 @@ define([
245247
marked(text, function (err, html) {
246248
html = security.sanitize_html(html);
247249
html = $($.parseHTML(html));
248-
html.find('img[src^="attachment:"]').each(function (i, h) {
250+
html.find('img[src^="attachment://"]').each(function (i, h) {
249251
h = $(h);
250-
var key = h.attr('src').replace(/^attachment:/, '');
252+
var key = h.attr('src').replace(/^attachment:\/\//, '');
251253
if (key in that.attachments) {
252254
data.attachments[key] = JSON.parse(JSON.stringify(
253255
that.attachments[key]));
@@ -344,7 +346,7 @@ define([
344346
// We generate names for blobs
345347
var key;
346348
if (blob.name !== undefined) {
347-
key = blob.name;
349+
key = encodeURIandParens(blob.name);
348350
} else {
349351
key = '_auto_' + Object.keys(that.attachments).length;
350352
}
@@ -357,7 +359,7 @@ define([
357359
'type (' + d[0] + ')');
358360
}
359361
that.add_attachment(key, blob.type, d[1]);
360-
var img_md = '![attachment:' + key + '](attachment:' + key + ')';
362+
var img_md = '![' + key + '](attachment://' + key + ')';
361363
that.code_mirror.replaceRange(img_md, pos);
362364
}
363365
reader.readAsDataURL(blob);
@@ -404,9 +406,9 @@ define([
404406
html.find("a[href]").not('[href^="#"]').attr("target", "_blank");
405407
// replace attachment:<key> by the corresponding entry
406408
// in the cell's attachments
407-
html.find('img[src^="attachment:"]').each(function (i, h) {
409+
html.find('img[src^="attachment://"]').each(function (i, h) {
408410
h = $(h);
409-
var key = h.attr('src').replace(/^attachment:/, '');
411+
var key = h.attr('src').replace(/^attachment:\/\//, '');
410412

411413
if (key in that.attachments) {
412414
var att = that.attachments[key];

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"build:css": "concurrent \"npm run build:css:ipython\" \"npm run build:css:style\"",
1717
"build:css:ipython": "lessc --include-path=notebook/static notebook/static/style/ipython.less notebook/static/style/ipython.min.css",
1818
"build:css:style": "lessc --include-path=notebook/static notebook/static/style/style.less notebook/static/style/style.min.css",
19-
"build:css:watch": "echo Not implemented yet...",
19+
"build:css:watch": "./scripts/less-watch ./notebook/static",
2020
"build:js": "webpack",
2121
"build:js:watch": "npm run build:js -- --watch"
2222
},

scripts/less-watch

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
5+
Usage:
6+
./scripts/less-watch [watchPath]
7+
8+
Example:
9+
./scripts/less-watch ./notebook/static/notebook/less
10+
11+
**/
12+
13+
var less = require('less');
14+
var fs = require('fs');
15+
var path = require('path');
16+
var child_process = require('child_process');
17+
18+
function watchDir(dir) {
19+
var rootPath = path.join(__dirname, '..');
20+
var watchPath = path.resolve(dir);
21+
console.log('less-watch:', 'watching:', path.relative(rootPath, watchPath));
22+
fs.watch(watchPath, {recursive: true}, function(event, file) {
23+
if (file && /.+\.less$/.test(file)) {
24+
console.log('less-watch:', 'modified:', file);
25+
child_process.exec('lessc --include-path=notebook/static --verbose notebook/static/style/style.less notebook/static/style/style.min.css', function(err, stdout, stderr) {
26+
if (err) return console.log(err);
27+
if (stdout) console.log(stdout);
28+
if (stderr) console.log(stderr);
29+
});
30+
child_process.exec('lessc --include-path=notebook/static notebook/static/style/ipython.less notebook/static/style/ipython.min.css', function(err, stdout, stderr) {
31+
if (err) return console.log(err);
32+
if (stdout) console.log(stdout);
33+
if (stderr) console.log(stderr);
34+
});
35+
}
36+
});
37+
}
38+
39+
watchDir(process.argv[2]);

0 commit comments

Comments
 (0)